on master help sign in
Add highlight support for tree-sitter-query language (tsq) (#845)
e069fb9Michael Davis
.gitmodules+4
@@ -126,3 +126,7 @@
126 path = helix-syntax/languages/tree-sitter-vue
126 path = helix-syntax/languages/tree-sitter-vue
127 url = https://github.com/ikatyang/tree-sitter-vue
127 url = https://github.com/ikatyang/tree-sitter-vue
128 shallow = true
128 shallow = true
129+[submodule "helix-syntax/languages/tree-sitter-tsq"]
130+ path = helix-syntax/languages/tree-sitter-tsq
131+ url = https://github.com/tree-sitter/tree-sitter-tsq
132+ shallow = true
helix-syntax/languages/tree-sitter-tsqnew file+1

Submodule changed.

languages.toml+8
@@ -328,3 +328,11 @@ language-server = { command = "swipl", args = [
328 "-g", "use_module(library(lsp_server))",
328 "-g", "use_module(library(lsp_server))",
329 "-g", "lsp_server:main",
329 "-g", "lsp_server:main",
330 "-t", "halt", "--", "stdio"] }
330 "-t", "halt", "--", "stdio"] }
331+
332+[[language]]
333+name = "tsq"
334+scope = "source.tsq"
335+file-types = ["scm"]
336+roots = []
337+comment-token = ";"
338+indent = { tab-width = 2, unit = " " }
runtime/queries/tsq/highlights.scmnew file+46
@@ -0,0 +1,46 @@
1+; mark the string passed #match? as a regex
2+(((predicate_name) @function
3+ (capture)
4+ (string) @string.regexp)
5+ (#eq? @function "#match?"))
6+
7+; highlight inheritance comments
8+((query . (comment) @keyword.directive)
9+ (#match? @keyword.directive "^;\ +inherits *:"))
10+
11+[
12+ "("
13+ ")"
14+ "["
15+ "]"
16+] @punctuation.bracket
17+
18+":" @punctuation.delimiter
19+
20+[
21+ (one_or_more)
22+ (zero_or_one)
23+ (zero_or_more)
24+] @operator
25+
26+[
27+ (wildcard_node)
28+ (anchor)
29+] @constant.builtin
30+
31+[
32+ (anonymous_leaf)
33+ (string)
34+] @string
35+
36+(comment) @comment
37+
38+(field_name) @property
39+
40+(capture) @label
41+
42+(predicate_name) @function
43+
44+(escape_sequence) @escape
45+
46+(node_name) @variable