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.3.tar.gz (43.4 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.3-cp310-abi3-win_arm64.whl (35.4 kB view details)

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.2.3-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.2.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (66.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_javadoc-0.2.3-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.2.3-cp310-abi3-macosx_11_0_arm64.whl (35.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_javadoc-0.2.3-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.2.3.tar.gz.

File metadata

  • Download URL: tree_sitter_javadoc-0.2.3.tar.gz
  • Upload date:
  • Size: 43.4 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.3.tar.gz
Algorithm Hash digest
SHA256 7c4b08b70caa41e8424320030153ac01323912f88a844f7b15cb43a9ab0b0ea6
MD5 3900eb57551a165010b93cdcbc63f5f2
BLAKE2b-256 248c2d58b9f25e358f88deb5eeee0633014229a117b786e820a76c635eb2cfca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 94bd8080d544156c1e8dda315665be3a7aaa1b3e96d5666399b61e318732dd68
MD5 6607a12c7e547915a4e6488a17c62bf9
BLAKE2b-256 b675b33fdec0d44bdea2c0f88df4a34e876fa9a737740e984342795033076bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8b616bef1ff056c4b908aad82cc9fe8a0d5e38b711e9f60ef0f8f5a587136c3e
MD5 91d00937cc2fc17986d680927a8ab73b
BLAKE2b-256 890c125d4ba6337af072189d17817c07ad40784b72a1c9f93527e36802c075b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f63c83ddf479c2842cec2b0941d3b265254b12d7b403c63c4127857fb60b5803
MD5 ce26770558d28ef9a5cbc38a6065cfb1
BLAKE2b-256 58ee61fd8c2770660d4cee3e170f10eaf5466e6c429f2275425255dcde9203c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 205279619993ccec91ea1a214da5530a71bd7a21f0ad8115d6bfb9363fd11f93
MD5 2389ec59a1e0ce2ffd56dc75c629d4ab
BLAKE2b-256 2173c019d4b1960c5e3170967eb984b62a043195446a6fe3fdb1aca93c82507c

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.2.3-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.3-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb7570d507e85100dd37fbdf4996a4d7e5a13e919ab9f44764e4e4c273dd6cfd
MD5 1ed9a000d52fe416b80bc92e800cc02a
BLAKE2b-256 e7afcdc3f47a1b67d00be199abe51f11a6900275a476e641069dfc93104817b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73b0fd9e78fc65bde08509d3bdb7b3ae1f72d0f7121b10eb7180d0d07592b5e6
MD5 58cd117c50e401283a2d02fd331e74dc
BLAKE2b-256 53b1a6dc680646beef520cfe80d0aefe8a63db19bf75b71d3c426e6820ea1543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.3-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ccfd4f5d2a845ebf1f98114666e4b49ab581cfaec7a0ad7cb70cd6ef4430aced
MD5 8bedc1498ce3be5d4654eb63c4da4541
BLAKE2b-256 20107b5dca5f277021dfeb87fcd217e76e7b6e1696eb7e5e063cb099a65b6501

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