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.1.1.tar.gz (43.3 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.1.1-cp310-abi3-win_arm64.whl (35.2 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_javadoc-0.1.1-cp310-abi3-win_amd64.whl (37.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.1.1-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.1.1-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.1.1-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.3 kB view details)

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

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.1.1-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.1.1.tar.gz.

File metadata

  • Download URL: tree_sitter_javadoc-0.1.1.tar.gz
  • Upload date:
  • Size: 43.3 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.1.1.tar.gz
Algorithm Hash digest
SHA256 f82f89ed4db9ad0800a401b0fa2b5751956d2dee5f3b97b550d6934676bd4460
MD5 53bfa53df7412a2436d31bf4baa7a427
BLAKE2b-256 af6802c29a1dfffee0bc967677358b21d297d9ae625b48d7c576909a90add84c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 6b9be81558fc9d0438be236e066969d6e5c2d9dc84ce0d27827152dae04b454d
MD5 e87b71671ba82688c7c5a406af556427
BLAKE2b-256 2c3e5122e5898dbf6dc53c463d158c32394cacd903587d7206af6e3ad4df64f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 78fa7ca111eee32f68c01174d4ad2a8a1a100cf6cfaa910b7e1aed3c61d612b0
MD5 7191cdec3feedf17a0bebcf75254be60
BLAKE2b-256 ecd704ec05dbf1d553b2db924302b747bf959e45f297804b446d88d57272a443

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e0a1ec57250ba9fb2200e5da619a85a80807cdb9ee726d640a5590cd5834e897
MD5 459d74e2767e735912060de51079f5cc
BLAKE2b-256 fb255b795e739c3c02af46248741c2deba50697fd2df4b2a917dd5dd39564623

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01e0835780f32b721b85268adaf3455c720ae9cfa5a5e5c3bae2edde598ab303
MD5 013ef144041263be967f1887a49a700e
BLAKE2b-256 48b2111b383fea5698e4248d95c0a401aa2dce9cd9990b44359fbdd6cdfd1bb5

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.1.1-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.1.1-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 506b56d8a8d6786fe66dce2bea10d326483d14e9c85a24c94dce05d5668cfc7a
MD5 ed644e9cdfec1ad9d48a5c425001a27a
BLAKE2b-256 a00e6f65f50646c81ce38b072e932536fe50cdf9e94a756680bddce741d28edc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c41c9ebdf8f211bd15779319e9cf4b74d7eba34a1dbe43e3296fa91bd78bd1fd
MD5 cf70a34cd15ae4ba7e5b8be8d70061da
BLAKE2b-256 a146b7def5fe91b2d9d73a39242547220a553324a11dfc951531a4bf8eb467f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.1-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb0f994febb40208216a36412458944b4e64c751441e8a180739787c703765d0
MD5 db17c9867710b7b9e77ec83ad5b5722a
BLAKE2b-256 25e66ef74d6749952fb1be13ebe7bb68028c4961a322044190b251de77574495

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