Skip to content

feat(doxygen): add Javadoc/Doxygen syntax highlighting#204

Open
da-r-k wants to merge 2 commits intozed-extensions:mainfrom
da-r-k:feat/doxygen-javadoc-highlighting
Open

feat(doxygen): add Javadoc/Doxygen syntax highlighting#204
da-r-k wants to merge 2 commits intozed-extensions:mainfrom
da-r-k:feat/doxygen-javadoc-highlighting

Conversation

@da-r-k
Copy link
Contributor

@da-r-k da-r-k commented Feb 26, 2026

Summary

Add syntax highlighting for Javadoc/Doxygen tags (@param, @return, @throws, etc.) inside /** */ comments by integrating the tree-sitter-doxygen grammar.

Changes

  • Add tree-sitter-doxygen grammar to extension.toml
  • Add languages/doxygen/ with config.toml (hidden language) and highlights.scm
  • Fix injection regex in injections.scm to properly match /** Javadoc comments

Notes

  • Uses a WASM-compatible fork of tree-sitter-doxygen because the upstream scanner uses libc functions (fprintf, isalnum, iswspace) unavailable in Zed's WASM sandbox
  • Upstream PR to fix this: tree-sitter-grammars/tree-sitter-doxygen#21
  • Once upstream merges, the grammar URL should be updated back to tree-sitter-grammars/tree-sitter-doxygen

Testing

  • Install as dev extension in Zed
  • Open any Java file with Javadoc comments
  • @param, @return, @throws etc. should be highlighted as keywords
  • Parameter names after @param should be highlighted as variables

Add tree-sitter-doxygen grammar and injection rules to highlight
Javadoc tags (@param, @return, @throws, etc.) inside /** comments.

Uses a WASM-compatible fork of tree-sitter-doxygen until
tree-sitter-grammars/tree-sitter-doxygen#21 is merged upstream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cla-bot cla-bot bot added the cla-signed label Feb 26, 2026
@tartarughina
Copy link
Collaborator

tartarughina commented Feb 26, 2026

@da-r-k thanks for the addition, let's see if tree-sitter-grammars/tree-sitter-doxygen#21 gets merged. Let's give the team a couple of days.

- Inject Java syntax into @code/@Endcode blocks
- Restrict tag highlighting to valid Javadoc tags only
- Remove Doxygen-only features (\a, \c emphasis)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@da-r-k
Copy link
Contributor Author

da-r-k commented Feb 27, 2026

image

This is the syntax highlighting we get

@tartarughina
Copy link
Collaborator

Doesn't @param feel off to you? Why not having it as other @?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants