on master help sign in
WGSL syntax highlighting fix (#3996)
60aa7d3Chickenkeeper
languages.toml+1−1
@@ -848,7 +848,7 @@ indent = { tab-width = 4, unit = " " }
848
848
849[[grammar]]
849[[grammar]]
850name = "wgsl"
850name = "wgsl"
851−source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "f00ff52251edbd58f4d39c9c3204383253032c11" }
851+source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "272e89ef2aeac74178edb9db4a83c1ffef80a463" }
852
852
853[[language]]
853[[language]]
854name = "llvm"
854name = "llvm"
runtime/queries/wgsl/highlights.scm+37−25
@@ -1,23 +1,41 @@
1+(int_literal) @constant.numeric.integer
1−(const_literal) @constant.numeric
2+(float_literal) @constant.numeric.float
3+(bool_literal) @constant.builtin.boolean
2
4
5+(global_constant_declaration) @variable
6+(global_variable_declaration) @variable
7+(compound_statement) @variable
8+(const_expression) @function
9+
10+(variable_identifier_declaration
11+ (identifier) @variable
3−(type_declaration) @type
12+ (type_declaration) @type)
4
13
5(function_declaration
14(function_declaration
6− (identifier) @function)
15+ (identifier) @function
16+ (function_return_type_declaration
17+ (type_declaration) @type))
18+
19+(parameter
20+ (variable_identifier_declaration
21+ (identifier) @variable.parameter
22+ (type_declaration) @type))
7
23
8(struct_declaration
24(struct_declaration
9 (identifier) @type)
25 (identifier) @type)
26+
27+(struct_declaration
28+ (struct_member
29+ (variable_identifier_declaration
30+ (identifier) @variable.other.member
31+ (type_declaration) @type)))
10
32
11(type_constructor_or_function_call_expression
33(type_constructor_or_function_call_expression
12 (type_declaration) @function)
34 (type_declaration) @function)
13
35
14−(parameter
15− (variable_identifier_declaration (identifier) @variable.parameter))
16−
17[
36[
18 "struct"
37 "struct"
19 "bitcast"
38 "bitcast"
20− ; "block"
21 "discard"
39 "discard"
22 "enable"
40 "enable"
23 "fallthrough"
41 "fallthrough"
@@ -26,36 +44,28 @@
26 "private"
44 "private"
27 "read"
45 "read"
28 "read_write"
46 "read_write"
29− "return"
30 "storage"
47 "storage"
31 "type"
48 "type"
32 "uniform"
49 "uniform"
33 "var"
50 "var"
34 "workgroup"
51 "workgroup"
35 "write"
52 "write"
53+ "override"
36 (texel_format)
54 (texel_format)
37−] @keyword ; TODO reserved keywords
55+] @keyword
38
56
39−[
57+"fn" @keyword.function
40− (true)
41− (false)
42−] @constant.builtin.boolean
43
58
44−[ "," "." ":" ";" ] @punctuation.delimiter
59+"return" @keyword.control.return
45
60
46−;; brackets
61+["," "." ":" ";"] @punctuation.delimiter
47−[
62+
48− "("
49− ")"
50− "["
51− "]"
52− "{"
53− "}"
54−] @punctuation.bracket
63+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
55
64
56[
65[
57 "loop"
66 "loop"
58 "for"
67 "for"
68+ "while"
59 "break"
69 "break"
60 "continue"
70 "continue"
61 "continuing"
71 "continuing"
@@ -64,7 +74,6 @@
64[
74[
65 "if"
75 "if"
66 "else"
76 "else"
67− "elseif"
68 "switch"
77 "switch"
69 "case"
78 "case"
70 "default"
79 "default"
@@ -92,10 +101,13 @@
92 "*"
101 "*"
93 "~"
102 "~"
94 "^"
103 "^"
104+ "@"
105+ "++"
106+ "--"
95] @operator
107] @operator
96
108
97(attribute
109(attribute
98− (identifier) @variable.other.member)
110+ (identifier) @attribute)
99
111
100(comment) @comment
112(comment) @comment
101
113