Skip to main content

Parser for Javadoc documentation comments

Project description

tree-sitter-javadoc

Javadoc grammar for tree-sitter

About

Features:

  • Complete old-school HTML (/**)
  • Basic new-school Markdown (///) support
  • Highlight queries, especially for those important/pesky @see and @link references
  • @nospell set for javadocs syntax regions, so you don't have to turn spellcheck off anymore
  • Injection queries for @snippet, @value
  • Support for custom inline and block doclet tags
  • Tested on heaps of java code, popular open source codebases
  • Not perfect, but javadocs parsing is a dirty business

Neovim Installation (for use in your editor)

Install nvim-treesitter, then from neovim:

:TSInstall java javadoc html css printf comment

It is recommended to install at least these parsers for treesitter support of java code.

Bindings Installation (for development)

Bindings are published to pypi, npm, and crates.io as tree-sitter-javadoc. Wasm and source code artifacts are published to GitHub releases

Customize

You can customize highlighting by creating custom query files in ~/.config/nvim/queries/:

Example customization: conventions-based highlighting

This ;; extends the default queries, and adds additional queries based on standard coding conventions. Many treesitter parsers do this, including java, but neovim is trying to move away from it. If you use an LSP with semantic token support, you don't need this. Otherwise, it might be useful to you.

~/.config/nvim/queries/javadoc/highlights.scm:

;; extends

; Capitalized methods in javadoc references are treated as constructors.
(((method
    (identifier) @constructor)
    (#lua-match? @constructor "^[A-Z]")))

; Screaming-case members are treated as constants.
((member
  (identifier) @constant)
  (#lua-match? @constant "^[A-Z_][A-Z0-9_]+$"))

; Camel-case members are treated as types.
((member
  (identifier) @type)
  (#lua-match? @type "^[A-Z].*[a-z]"))

Example customization: disable HTML and markdown highlighting

The default highlighting incorporates highlighting of HTML and markdown tags via their respective parsers. For a more minimal approach with just highlighting of block and inline tags, you can override the injections.

~/.config/nvim/queries/javadoc/injections.scm:

; overriding with an empty query file to disable injections

Screenshot of highlights

Syntax highlighting screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_javadoc-0.0.4.tar.gz (43.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_javadoc-0.0.4-cp310-abi3-win_arm64.whl (35.1 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_javadoc-0.0.4-cp310-abi3-win_amd64.whl (37.0 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl (44.6 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (66.0 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_11_0_arm64.whl (35.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_10_9_x86_64.whl (33.9 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_javadoc-0.0.4.tar.gz.

File metadata

  • Download URL: tree_sitter_javadoc-0.0.4.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree_sitter_javadoc-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9190d99d62474c51562deaacb23af17f2f23c5cc8c8727986c4d5f2457ae7ee4
MD5 d3041e5d0e954fa7f7ba68cf88ed82fe
BLAKE2b-256 a556af170767517953969d54006c3d2588dd553ec2da4107f2dc5bfc63952b30

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 3f470b506e9770ef2c1cd9c06cf2774e6b330eaee5a066ad690f25f01dfb6985
MD5 22c9ddb0a755c0e735c5d97bc3ad4d5a
BLAKE2b-256 90d64c3456274e7073ff26b2bdab904eef19c4c27c9f69683e439bb1a5d06e8e

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9c90719d2282b3075337d536d9477df15951491102ad92ebf72aed64970b2aad
MD5 7dc8d47a84c22ce5c2d0f5b88a989110
BLAKE2b-256 27991b6e14a65ba62d845276b8544cb0b5539974563bb843c841aa6ee77364a0

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 45d6dd0b0501873097682ec6f5603d132c4668c49b449daa87ff747573742d44
MD5 6696056ec49aecf27ad0e0bae43db500
BLAKE2b-256 efcfc4ad828e77c5587d88a13bf3045b1f822e1ed6d4876a5c304d5f02530d3f

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8f0834dcceaf331e34dffb90b9f82d654f197919c098b962e0973f8e861a0164
MD5 5310ca3e7a9a4ab52b0d68ea23113601
BLAKE2b-256 69106e9658d92efdcaa363254a9f4334dfb6600370ad583af53f5300575faa68

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50803c99896fa952178f9d332145e2e9f9afaeba647cc126b0fafa5f512823ef
MD5 2e880dafb05cb5a48d8956fb6a271ee7
BLAKE2b-256 d6495089fd0ac49276dc3e67499dd605213ddc97bf40b16562c6ee158a1aa730

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c8b974c090e011e449b324539298e2c016115ab77609fd5a078804995876b04
MD5 a0684af8737616e784f9d495c3a80648
BLAKE2b-256 9a3bab4366179e4aef75a2355ad7406bc2b0995aa56f496647d8c321ba4a0b84

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.4-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0d43d5a282f4e16ee4c22708bcf8c7e64a9185f53e4abaeef3695a22d52b98db
MD5 dca8d7209244cb008068012dd302e313
BLAKE2b-256 9550ddf28ee23b3ef4263cb5787c2826735f1ccc7ca8bfbd3cfca4264e13af8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page