aacd0c8aa5
A few changes to make TSQ highlights better: * A parsing error has been fixed in the grammar itself * Previously tree-sitter-tsq did not parse the variables in predicates like `(#set! injection.language "javascript")` * Theme nodes as `tag` * The newly added node to the parser (from the above fix) is `variable` which takes over the `variable` capture from nodes * Highlight known predicates as `function` and unsupported predicates as `error` * This may help when translating queries from nvim-treesitter. For example `#any-of?` is a common one used in nvim-treesitter queries but not implemented in Helix or tree-sitter-cli. * Inject tree-sitter-regex into `#match?` predicates
50 lines
849 B
Scheme
50 lines
849 B
Scheme
; mark the string passed #match? as a regex
|
|
(((predicate_name) @function
|
|
(capture)
|
|
(string) @string.regexp)
|
|
(#eq? @function "#match?"))
|
|
|
|
; highlight inheritance comments
|
|
((query . (comment) @keyword.directive)
|
|
(#match? @keyword.directive "^; +inherits *:"))
|
|
|
|
[
|
|
"("
|
|
")"
|
|
"["
|
|
"]"
|
|
] @punctuation.bracket
|
|
|
|
":" @punctuation.delimiter
|
|
"!" @operator
|
|
|
|
[
|
|
(one_or_more)
|
|
(zero_or_one)
|
|
(zero_or_more)
|
|
] @operator
|
|
|
|
[
|
|
(wildcard_node)
|
|
(anchor)
|
|
] @constant.builtin
|
|
|
|
[
|
|
(anonymous_leaf)
|
|
(string)
|
|
] @string
|
|
|
|
(comment) @comment
|
|
|
|
(field_name) @variable.other.member
|
|
|
|
(capture) @label
|
|
|
|
((predicate_name) @function
|
|
(#match? @function "^#(eq\\?|match\\?|is\\?|is-not\\?|not-same-line\\?|not-kind-eq\\?|set!|select-adjacent!|strip!)$"))
|
|
(predicate_name) @error
|
|
|
|
(escape_sequence) @constant.character.escape
|
|
|
|
(node_name) @tag
|
|
(variable) @variable
|