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.5.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.5-cp310-abi3-win_arm64.whl (35.1 kB view details)

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.0.5-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.5-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.5-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.5-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.5-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.5.tar.gz.

File metadata

  • Download URL: tree_sitter_javadoc-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 82504471d0b8190eac2af323a23c71312a0cedb227d5cc00c638992f45e9b8bf
MD5 1651a90a2fdebed273648849e4d2ca2a
BLAKE2b-256 8b0102da9133b0881ee455ebb13f2ddca958ded4b2437b4d19bcdf106d168484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 bdf91a3ab7d5cd8320a6c0a37480a57c73924e3b830d7e3ad81224c44204df5b
MD5 8096efc1241b718925d9ca03b42f17a7
BLAKE2b-256 e4f0b5d30126821ec7335fef63fb26a10ff429039d77e5a5c28e7080e4f870c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d7a5c3e453d9b6d6d5f2917c52863775fbbef6082ad0968b6c1f913c913bd609
MD5 42672b86142d7322af0e9da1fdad3963
BLAKE2b-256 170dcd9ff0d1bcc3f6240faf1506e0c68da6a1860cf6c88cf6fbeab21bb1d9ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8621dc4168206de07f9c63ba8fa7f2c66f8cc500905c76f764b2e679c6337d1c
MD5 ba775c8ee19233965a47a497981c5c19
BLAKE2b-256 2b51ddb7cd9e7a27b58041927b08b608bb4ee18c29877e362b29c4fe0fb7bbb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3249db8a0164a158be1d903283e88a04e463cefa4f97c366a9b0db0e6bd41865
MD5 171ae9916d94ea110c9a9b62c6c44354
BLAKE2b-256 54d8a6b7e2d5930ca4db51553d51f0d3c50421be8ed705bba6383c002df84d2c

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.0.5-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.5-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7617fce98511abedbac6aa29df9f8c6685827b26a5d3f3f521524b8ef1acb837
MD5 c69994dfe1294da8d8cc60617a905ab5
BLAKE2b-256 0d8e1566a45f56d8b287b042626d340d0af6b60e2c535cdd387f2b05fac026ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16c677d28aa8ded40d885acac1ec8779f4faf0b21c8c65e1a8f3bdca53bc9770
MD5 6aef1bb06690205b8b95a6352582616d
BLAKE2b-256 9681e0a34545491ba73c157955c2b0747e4ecc3dc7c080691e01c9f34ed1e640

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.0.5-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4856593e369725d5d13106506e53e82c42316b9f956fb52461457e1f1ccc72f1
MD5 6470e316e1cf6eb17dd29d4468d801d4
BLAKE2b-256 6058358fe1779e3ef929716fc1829fbf1e50940cb3dc108c175f50857e598993

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