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

Uploaded CPython 3.10+Windows ARM64

tree_sitter_javadoc-0.2.2-cp310-abi3-win_amd64.whl (36.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.2.2-cp310-abi3-musllinux_1_2_x86_64.whl (44.4 kB view details)

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

tree_sitter_javadoc-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (65.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_javadoc-0.2.2-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.1 kB view details)

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

tree_sitter_javadoc-0.2.2-cp310-abi3-macosx_11_0_arm64.whl (34.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.2.2-cp310-abi3-macosx_10_9_x86_64.whl (33.7 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_javadoc-0.2.2.tar.gz
  • Upload date:
  • Size: 43.1 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.2.2.tar.gz
Algorithm Hash digest
SHA256 959379d672df5e6332550e95293eb2ff3fcaddf70ec6d30346a6dc0f3a97ce3f
MD5 9c7536c12722559a20879f4d13025778
BLAKE2b-256 ebac1e4dd8d6d0e1d19b9bde65974075a6a38021bc0ca109c40c5fdb00287d61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 0609c4f90ca4e09ef3264a589490b54edc303fbfe8b5a197196a2f93d3a9a4b1
MD5 c1e65af653cf8ed9c7cc5c9201940aa9
BLAKE2b-256 3803615192b3fdb6502b3187d98b9b816e7c73299cfd2a20760eb6fcb23c321f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 38531fca6f34abc836df58524d9a4eea0465b6aa9f1b92603de8bcfa8c609300
MD5 1dd0f7e7f7f11c599cf42cf856c364cf
BLAKE2b-256 b00e59600b4c4376137f0a3e624372b9770ab4b090a6d1d0531152736366f92f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 71405e4378fd19f6aa4bd45e8d5c1829c7b6f67e93dff3c5e115d222961b2a66
MD5 99282c2da92297cf80190a85e2c91564
BLAKE2b-256 3c7bd978605ba4f92ae654e1c453c30fd2c7bda440ba02e538ebe9515b4a0e95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1dd75355913fcf5ee2647f82385bd2f77ca4886cda9fcb52960ff3e73efa281d
MD5 44f6cba5f4d336647fe7654240224a2e
BLAKE2b-256 35432a5fef01b04e2e6a217bf05d1547fb6280f19e8163a781c9cf9e2fc4d921

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.2.2-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.2.2-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f9c7fc5bca4f110d2bf549393cbd0384658ab2000fa8cb25d03a6b6d2a6b91c
MD5 e4e889e42b8b9096f0521ff14c34b79b
BLAKE2b-256 06f5bb784a0ede46f572458e1aed9f612776289010a89486f7bf6d108555079e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4853dda65328ff69ff029ddb5eb7c93856d818908c51e68f28c337218544327a
MD5 9eb5aa9e66fbe519fdd05e61ff6b3dfd
BLAKE2b-256 f996e8ef75bdef095d7b2fd395567fc3e39d98334810ccf85b8c0759eb7e4792

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.2-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 99cdf281b90474da11feb69b411b1d5a6b86d22f52d98cba0c4257f6fbe61942
MD5 ee22ac1f5e11ac11758d58070ec72a43
BLAKE2b-256 3cb468c8008696ee0a197084bc3635b233109ff7ef8fa7a85e0486f987bf42d4

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