on master help sign in
Add language support for WGSL (#1166)
4ec20eaKirawi
.gitmodules+4
@@ -142,3 +142,7 @@
142 path = helix-syntax/languages/tree-sitter-perl
142 path = helix-syntax/languages/tree-sitter-perl
143 url = https://github.com/ganezdragon/tree-sitter-perl
143 url = https://github.com/ganezdragon/tree-sitter-perl
144 shallow = true
144 shallow = true
145+[submodule "helix-syntax/languages/tree-sitter-wgsl"]
146+ path = helix-syntax/languages/tree-sitter-wgsl
147+ url = https://github.com/szebniok/tree-sitter-wgsl
148+ shallow = true
helix-syntax/languages/tree-sitter-wgslnew file+1

Submodule changed.

languages.toml+8
@@ -405,3 +405,11 @@ file-types = ["rkt"]
405shebangs = ["racket"]
405shebangs = ["racket"]
406comment-token = ";"
406comment-token = ";"
407language-server = { command = "racket", args = ["-l", "racket-langserver"] }
407language-server = { command = "racket", args = ["-l", "racket-langserver"] }
408+
409+[[language]]
410+name = "wgsl"
411+scope = "source.wgsl"
412+file-types = ["wgsl"]
413+roots = []
414+comment-token = "//"
415+indent = { tab-width = 4, unit = " " }
runtime/queries/wgsl/highlights.scmnew file+102
@@ -0,0 +1,102 @@
1+(const_literal) @constant.numeric
2+
3+(type_declaration) @type
4+
5+(function_declaration
6+ (identifier) @function)
7+
8+(struct_declaration
9+ (identifier) @type)
10+
11+(type_constructor_or_function_call_expression
12+ (type_declaration) @function)
13+
14+(parameter
15+ (variable_identifier_declaration (identifier) @variable.parameter))
16+
17+[
18+ "struct"
19+ "bitcast"
20+ ; "block"
21+ "discard"
22+ "enable"
23+ "fallthrough"
24+ "fn"
25+ "let"
26+ "private"
27+ "read"
28+ "read_write"
29+ "return"
30+ "storage"
31+ "type"
32+ "uniform"
33+ "var"
34+ "workgroup"
35+ "write"
36+ (texel_format)
37+] @keyword ; TODO reserved keywords
38+
39+[
40+ (true)
41+ (false)
42+] @constant.builtin.boolean
43+
44+[ "," "." ":" ";" ] @punctuation.delimiter
45+
46+;; brackets
47+[
48+ "("
49+ ")"
50+ "["
51+ "]"
52+ "{"
53+ "}"
54+] @punctuation.bracket
55+
56+[
57+ "loop"
58+ "for"
59+ "break"
60+ "continue"
61+ "continuing"
62+] @keyword.control.repeat
63+
64+[
65+ "if"
66+ "else"
67+ "elseif"
68+ "switch"
69+ "case"
70+ "default"
71+] @keyword.control.conditional
72+
73+[
74+ "&"
75+ "&&"
76+ "/"
77+ "!"
78+ "="
79+ "=="
80+ "!="
81+ ">"
82+ ">="
83+ ">>"
84+ "<"
85+ "<="
86+ "<<"
87+ "%"
88+ "-"
89+ "+"
90+ "|"
91+ "||"
92+ "*"
93+ "~"
94+ "^"
95+] @operator
96+
97+(attribute
98+ (identifier) @variable.other.member)
99+
100+(comment) @comment
101+
102+(ERROR) @error