Update TSQ queries (#2960)
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
commitaacd0c8aa542ac0316569ae062966362222ff4bf
authorMichael Davis <mcarsondavis@gmail.com>
dateTue 5 Jul 2022, 06:01 (4 years ago)
parentd78354c
languages.toml+1−1
@@ -707,7 +707,7 @@ indent = { tab-width = 2, unit = " " }
707707
708708[[grammar]]
709709name = "tsq"
710−source = { git = "https://github.com/the-mikedavis/tree-sitter-tsq", rev = "ea68fc2b571ca1c8f70936855130c380f518ff35" }
710+source = { git = "https://github.com/the-mikedavis/tree-sitter-tsq", rev = "48b5e9f82ae0a4727201626f33a17f69f8e0ff86" }
711711
712712[[language]]
713713name = "cmake"
runtime/queries/tsq/highlights.scm+6−3
@@ -6,7 +6,7 @@
66
77; highlight inheritance comments
88((query . (comment) @keyword.directive)
9− (#match? @keyword.directive "^;\ +inherits *:"))
9+ (#match? @keyword.directive "^; +inherits *:"))
1010
1111[
1212 "("
@@ -40,8 +40,11 @@
4040
4141(capture) @label
4242
43−(predicate_name) @function
43+((predicate_name) @function
44+ (#match? @function "^#(eq\\?|match\\?|is\\?|is-not\\?|not-same-line\\?|not-kind-eq\\?|set!|select-adjacent!|strip!)$"))
45+(predicate_name) @error
4446
4547(escape_sequence) @constant.character.escape
4648
47−(node_name) @variable
49+(node_name) @tag
50+(variable) @variable
runtime/queries/tsq/injections.scm+6
@@ -1,2 +1,8 @@
11((comment) @injection.content
22 (#set! injection.language "comment"))
3+
4+((predicate
5+ (predicate_name) @_predicate
6+ (string) @injection.content)
7+ (#eq? @_predicate "#match?")
8+ (#set! injection.language "regex"))