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.3.1.tar.gz (44.7 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.3.1-cp310-abi3-win_arm64.whl (36.9 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_javadoc-0.3.1-cp310-abi3-win_amd64.whl (38.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.3.1-cp310-abi3-musllinux_1_2_x86_64.whl (46.5 kB view details)

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

tree_sitter_javadoc-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl (46.5 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

tree_sitter_javadoc-0.3.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (47.0 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_javadoc-0.3.1-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (46.5 kB view details)

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

tree_sitter_javadoc-0.3.1-cp310-abi3-macosx_11_0_arm64.whl (36.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.3.1-cp310-abi3-macosx_10_9_x86_64.whl (35.3 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for tree_sitter_javadoc-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b6b6748288f6ddad8c0a0cd4f38eb00eec613c0151019c63c554df6d39a35a59
MD5 a139ef09c6500bd80e5a02bf04c37f99
BLAKE2b-256 284b5a525f8fc56728fc7f586af7e81a5d4996c6c5d628f198f6313f9c15feed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 437580be85b3695348fd110fda53189d6608223debdf259e4b3f799aa3ce7646
MD5 82413bc8c76abee3b01fb004eb159c2e
BLAKE2b-256 c44d1e247d8d5c91d44ea28efd8a7e6d4df86c11092f34c0c4a4429a54e5754a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 89dac069a43fdd1e6415fa6412c2237667850796f30f518376007f5da43aefb5
MD5 2642b1fd1d722f1acfb6d51da1495274
BLAKE2b-256 9813cf38ef227d60e21c8131cdb9ef8586b587fbfb18059f9c00dfcf21464b70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f6e66031131cb392459ab9e2fc952a64ebbb8ffae1e2867e71392d54ee1b54f8
MD5 cbd25d8f500c6d607f264e9697f635b7
BLAKE2b-256 62ca1cbe41b3642b93f60055448370e298d7f1b4e52df3888c0e9737930ff203

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 835bcf30be0d705340b2febd8f0adffe023fc344c40e99d66f60e98ad63ded21
MD5 ac1123276719e1b798f0bacb65b0abd8
BLAKE2b-256 56a3e6af6cb0bc31347e17ce5aba85e5b3fff7f0aa6b6a8d3abc8a53d658497d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fcc1bc7bdca8faf5a3bc53a73babebb4ffb7d61cba6c52c919fe666bc369113f
MD5 72c9f230a615b55d8524f2ebe389b711
BLAKE2b-256 412242cda1e5cff1da88655a534b96f67a5ec8e0bd1c41e876cd52878c55e1ce

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.3.1-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 a3941aa3161f48575b50ec3de415dfe76d77a1cb4cf6c273aae13ad177fb1aa2
MD5 77b69325e3c1413def8f3b28c56f4e3a
BLAKE2b-256 cd7e340b8dee126ee5fb74d9dcaeefce42ea804538bf7071ca377a42ff777579

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bde4ea1491eaf8b90e2221f43fdc77b520c89dfbeb4f4dc2e858f46954c9dce9
MD5 27b2bf996b6d48eeef4b09a701130be6
BLAKE2b-256 8fdf2c5a91fb40542511fdbabe7f94d366ba82cc99f65f48a13337259af64e8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.3.1-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9741ac5846e8e6ab7877823b359f8a5ad74e8f21daf88e787f34c4942a7148d6
MD5 8d5e9fee307bf62362e74cf719895263
BLAKE2b-256 22fbfdeffe68f76f27cb61f89c032ac4d7aaed2703d51ca7d207130782a6bdcb

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