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.0.tar.gz (43.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.1.0-cp310-abi3-win_arm64.whl (35.3 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_javadoc-0.1.0-cp310-abi3-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl (44.8 kB view details)

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

tree_sitter_javadoc-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (66.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_javadoc-0.1.0-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.4 kB view details)

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

tree_sitter_javadoc-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (35.2 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.1.0-cp310-abi3-macosx_10_9_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_javadoc-0.1.0.tar.gz
  • Upload date:
  • Size: 43.7 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.0.tar.gz
Algorithm Hash digest
SHA256 977362aea005a26f1353eb1a76aa95d8352b59c1e5c1ef92298789f7a48945b1
MD5 6213a4660838d74a5e511f90a688ad1b
BLAKE2b-256 d12ad2eec839b84f38a5c11e7914550dfce6cf6e0e86a6c1500125ef270f1949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 86561ded14da4e0c70790e082f4132b89ef713cf16a51ed19ac933abed3ce1c2
MD5 e3a4b27ef5206d6fa9231ebb7b280b63
BLAKE2b-256 648cbaf202dc15701b8aa688ade578f3e90ce0a073fe10e4bd84c77cb61559de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3312d22d31c114c5d60deedd6854e20947f522dbbc0f8be0a05e305bb65a6471
MD5 498dc2261a685cc226ef90d7360e06cc
BLAKE2b-256 a9b30fd3afe078d8a2a9326507f676b67f3184c18efe76d5fead21fa5a85a5bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9cf48eee4b1a22f2721c65d9537bbc6d32b9f12ff803e6bd43ca7fa071357fd5
MD5 54b2033a1be0136acd8356e6fd345dff
BLAKE2b-256 3b541a97f0bfe9f1bc6d12542b699c7e98ad4822dbb139bcedb1d0c1ccd7ada4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 587e816cc83b8286e6cbca9b510ec89ccbca0b7ca312e07a1a26c55f3902933b
MD5 8cde304873521a43feeace52c068787c
BLAKE2b-256 d942fc539192f32dd50a39d8bed98ff2ef177cf925354fa947b7081301f92f56

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.1.0-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.0-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fb8fd86866d1cabe038ce1591a052b6f40acf0128bac9c0cbc6fed041275f3c
MD5 1d0bbbc1e7bb02d8b923f640386c2ed0
BLAKE2b-256 b4e028766eba089cc16c9e34924c4aae1cced32cb2aec9a7c498efa691f2ee94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b0154b27e0dbf35696c5dca9690779305b246c38ec91c8d97eed9688bc66b88
MD5 1bfe89f372136e90274a82a46a3b24ee
BLAKE2b-256 b9ab76830827ef219bfaf63dadb011d73ccb90778841b1528142613b079c18cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.1.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e048c1ededa22bcb4b5c69a6d1c5879e34bb55dca0de1391adc57c75ed0ddb32
MD5 c6f3311d0589c8ff6c048f143cc239d6
BLAKE2b-256 c567b1b83bea9eed4d3e948ea0df89b03369ae0109e5470be24f99809878638b

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