mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 04:50:03 -04:00
feat(javadoc): add parser and queries (#7749)
Previously java was configured to use doxygen parser for documentation comments, but javadocs are not doxygen. Inline tags have a different syntax, block tags are not recognized, and doxygen creates a lot of errors during highlighting. Add parser for javadoc comments, with queries for highlights and injections.
This commit is contained in:
parent
20a7e40203
commit
652da0b40f
6 changed files with 132 additions and 11 deletions
|
|
@ -5,20 +5,13 @@
|
|||
(#set! injection.language "comment"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||
(#set! injection.language "doxygen"))
|
||||
(#lua-match? @injection.content "/[*][*][%s]")
|
||||
(#set! injection.language "javadoc"))
|
||||
|
||||
; markdown-style javadocs: https://openjdk.org/jeps/467
|
||||
; markdown-style javadocs https://openjdk.org/jeps/467
|
||||
((line_comment) @injection.content
|
||||
(#lua-match? @injection.content "^///%s")
|
||||
(#offset! @injection.content 0 4 0 0)
|
||||
(#set! injection.language "markdown_inline"))
|
||||
|
||||
; markdown-style javadocs: https://openjdk.org/jeps/467
|
||||
((line_comment) @injection.content
|
||||
(#lua-match? @injection.content "^///%s+[@]")
|
||||
(#offset! @injection.content 0 4 0 0)
|
||||
(#set! injection.language "doxygen"))
|
||||
(#set! injection.language "javadoc"))
|
||||
|
||||
((method_invocation
|
||||
name: (identifier) @_method
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue