Skip to content

Commit

Permalink
fix precedence in tree-sitter-comment highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Dec 18, 2021
1 parent cd5dc81 commit ea5f397
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
5 changes: 5 additions & 0 deletions f.comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This was originally reported in #123 by @alice & @bob

TODO(rendering): font bug
HACK: hackhackhack
BUG: whoops!
6 changes: 6 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,9 @@ file-types = ["rkt"]
shebangs = ["racket"]
comment-token = ";"
language-server = { command = "racket", args = ["-l", "racket-langserver"] }

[[language]]
name = "comment"
scope = "scope.comment"
roots = []
file-types = ["comment"]
25 changes: 15 additions & 10 deletions runtime/queries/comment/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@

":" @punctuation.delimiter

(tag (name) @ui.text (user)? @constant)

((tag ((name) @warning))
(#any-of? @warning "TODO" "HACK" "WARNING"))
((tag (name) @warning)
(#match? @warning "^(TODO|HACK|WARNING)$"))

("text" @warning
(#any-of? @warning "TODO" "HACK" "WARNING"))
(#match? @warning "^(TODO|HACK|WARNING)$"))

((tag ((name) @error))
(#any-of? @error "FIXME" "XXX" "BUG"))
((tag (name) @error)
(match? @error "^(FIXME|XXX|BUG)$"))

("text" @error
(#any-of? @error "FIXME" "XXX" "BUG"))
(match? @error "^(FIXME|XXX|BUG)$"))

(tag
(name) @ui.text
(user)? @constant)

; Issue number (#123)
; ("text" @number (#lua-match? @number "^#[0-9]+$"))
("text" @constant.numeric
(#match? @constant.numeric "^#[0-9]+$"))

; User mention (@user)
; ("text" @constant-numeric (#lua-match? @constant-numeric "^[@][a-zA-Z0-9_-]+$"))
("text" @tag
(#match? @tag "^[@][a-zA-Z0-9_-]+$"))

0 comments on commit ea5f397

Please sign in to comment.