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

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

tree_sitter_javadoc-0.2.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: tree_sitter_javadoc-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b91ab5f3e18a59fcce8f7ae60a6ba901f9cc928e45517f81b69da0ea9c05876a
MD5 5b2761c8b47890c24c4286526ad19cd7
BLAKE2b-256 828bc3a838baf6c60717f42759241aea701676ac4320a3473aaeefe3a5533809

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 6b9ca42d46c80123ce2f827cc3d425cba670a2eb23b398eda72dc7c9ed2a466e
MD5 ed5733a73e462f6ecb83fa0fc896262f
BLAKE2b-256 2347ff3adcda470ef28d514fd13741113163c71357e1f10f92fbd84796ea7fc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1e0ed326b6d4c96439479e7b55c7de6a60e7ff1f1a2972dad098c99fa1bd911e
MD5 7521dea0855edfa49aa23f678cb1eec2
BLAKE2b-256 17351ee1570128784abdf604f4a1410deeb7f1ce1f49886c4b532ec982fd0b88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1f9754d111798d35fe519df80f227613aa6c784dd8f7f6ed2756cde05ef88bc8
MD5 1fefd3cdd0bf21accff356402cc1bdd6
BLAKE2b-256 fa193c003493f8f49a9c65e8b18a01dab143b72468f9858cb1ca6a97419a9c92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0290db91ad9a9473f2f4337c863115a1486ee98a786ab143de0c59b2ce23f95c
MD5 f3e68c6c29d6b0858f4bbefd549fa648
BLAKE2b-256 96286149170431a05bb8b7b518521f58e1f316815730730e8b79afcf5a7cb4f6

See more details on using hashes here.

File details

Details for the file tree_sitter_javadoc-0.2.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.2.0-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aedef3f2d63487c57434fcc1a7db94c612ca46591fe82ecc9d0061a1400b9c62
MD5 c99dddae4b1c176ea38722598fd5e064
BLAKE2b-256 5742a6faf920784ba4949823cd49561ee6f5f76dc2511007e27e783f0e996f4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa4e41b378f18e3d0bd18ceac95ed46cc814cb7b30fe19e6a4c86de3ff90cd54
MD5 fe52df702275d19f18c04c1e79d62759
BLAKE2b-256 e01fd965cca247dc33e1253d3319133473a2183a0b0b042f01049c549cdbc93b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_javadoc-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a67803b8b7224ab5b063e1ac74926601380ba064d16b89886f1a7042975b6d96
MD5 492a68c42a65fc5c8da6b82a39f944ca
BLAKE2b-256 17fdc891371d91b9cbc67731652803d40a590933e56f6fbd1d4353149a60a146

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