mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
comment(highlights): reduce false positives (#4298)
There are a couple cases where the comment highlights will match things that aren't necessary a tag. For example in Rust, when commenting a block that deals with generics (generics are declared as `T: Type`), this may be distracting. So, instead of highlighting all tags, we can restrict to highlighting the explicit keywords. Ref https://github.com/stsewd/tree-sitter-comment/issues/14
This commit is contained in:
parent
7eb5f1a2e3
commit
1ec36fdcd5
1 changed files with 19 additions and 18 deletions
|
|
@ -1,36 +1,37 @@
|
||||||
(_) @spell
|
(_) @spell
|
||||||
|
|
||||||
[
|
((tag
|
||||||
"("
|
|
||||||
")"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
":" @punctuation.delimiter
|
|
||||||
|
|
||||||
(tag
|
|
||||||
(name) @text.todo
|
(name) @text.todo
|
||||||
(user)? @constant)
|
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||||
|
":" @punctuation.delimiter)
|
||||||
((tag ((name) @text.todo))
|
(#eq? @text.todo "TODO"))
|
||||||
(#eq? @text.todo "TODO"))
|
|
||||||
|
|
||||||
("text" @text.todo
|
("text" @text.todo
|
||||||
(#eq? @text.todo "TODO"))
|
(#eq? @text.todo "TODO"))
|
||||||
|
|
||||||
((tag ((name) @text.note))
|
((tag
|
||||||
(#any-of? @text.note "NOTE" "XXX"))
|
(name) @text.note
|
||||||
|
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
(#any-of? @text.note "NOTE" "XXX"))
|
||||||
|
|
||||||
("text" @text.note
|
("text" @text.note
|
||||||
(#any-of? @text.note "NOTE" "XXX"))
|
(#any-of? @text.note "NOTE" "XXX"))
|
||||||
|
|
||||||
((tag ((name) @text.warning))
|
((tag
|
||||||
(#any-of? @text.warning "HACK" "WARNING"))
|
(name) @text.warning
|
||||||
|
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
(#any-of? @text.warning "HACK" "WARNING"))
|
||||||
|
|
||||||
("text" @text.warning
|
("text" @text.warning
|
||||||
(#any-of? @text.warning "HACK" "WARNING"))
|
(#any-of? @text.warning "HACK" "WARNING"))
|
||||||
|
|
||||||
((tag ((name) @text.danger))
|
((tag
|
||||||
(#any-of? @text.danger "FIXME" "BUG"))
|
(name) @text.danger
|
||||||
|
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
(#any-of? @text.danger "FIXME" "BUG"))
|
||||||
|
|
||||||
("text" @text.danger
|
("text" @text.danger
|
||||||
(#any-of? @text.danger "FIXME" "BUG"))
|
(#any-of? @text.danger "FIXME" "BUG"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue