aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/wgsl
diff options
context:
space:
mode:
authorChickenkeeper2022-10-14 01:31:32 +0000
committerGitHub2022-10-14 01:31:32 +0000
commitb4e795d70430d28ecd37f8e1564cbd568d17e0b9 (patch)
treea214d732dcb1fcdc2b73dda556f4599384605c57 /runtime/queries/wgsl
parentcf4a5cca96aa6a35182ce336e066e9aec34b38d2 (diff)
Fix C++ syntax highlighting, and improve C & WGSL highlighting (#4079)
Diffstat (limited to 'runtime/queries/wgsl')
-rw-r--r--runtime/queries/wgsl/highlights.scm175
1 files changed, 89 insertions, 86 deletions
diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm
index baf9dd8f..2817ea3a 100644
--- a/runtime/queries/wgsl/highlights.scm
+++ b/runtime/queries/wgsl/highlights.scm
@@ -2,57 +2,26 @@
(float_literal) @constant.numeric.float
(bool_literal) @constant.builtin.boolean
-(global_constant_declaration) @variable
-(global_variable_declaration) @variable
-(compound_statement) @variable
-(const_expression) @function
-
-(variable_identifier_declaration
- (identifier) @variable
- (type_declaration) @type)
-
-(function_declaration
- (identifier) @function
- (function_return_type_declaration
- (type_declaration) @type))
-
-(parameter
- (variable_identifier_declaration
- (identifier) @variable.parameter
- (type_declaration) @type))
-
-(struct_declaration
- (identifier) @type)
-
-(struct_declaration
- (struct_member
- (variable_identifier_declaration
- (identifier) @variable.other.member
- (type_declaration) @type)))
+[
+ "bitcast"
+ "discard"
+ "enable"
+ "fallthrough"
+] @keyword
-(type_constructor_or_function_call_expression
- (type_declaration) @function)
+[
+ "let"
+ "override"
+ "struct"
+ "type"
+ "var"
+ (texel_format)
+] @keyword.storage.type
[
- "struct"
- "bitcast"
- "discard"
- "enable"
- "fallthrough"
- "fn"
- "let"
- "private"
- "read"
- "read_write"
- "storage"
- "type"
- "uniform"
- "var"
- "workgroup"
- "write"
- "override"
- (texel_format)
-] @keyword
+ (access_mode)
+ (address_space)
+] @keyword.storage.modifier
"fn" @keyword.function
@@ -62,53 +31,87 @@
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+(type_declaration ["<" ">"] @punctuation.bracket)
+
[
- "loop"
- "for"
- "while"
- "break"
- "continue"
- "continuing"
+ "break"
+ "continue"
+ "continuing"
+] @keyword.control
+
+[
+ "loop"
+ "for"
+ "while"
] @keyword.control.repeat
[
- "if"
- "else"
- "switch"
- "case"
- "default"
+ "if"
+ "else"
+ "switch"
+ "case"
+ "default"
] @keyword.control.conditional
[
- "&"
- "&&"
- "/"
- "!"
- "="
- "=="
- "!="
- ">"
- ">="
- ">>"
- "<"
- "<="
- "<<"
- "%"
- "-"
- "+"
- "|"
- "||"
- "*"
- "~"
- "^"
- "@"
- "++"
- "--"
+ "!"
+ "!="
+ "%"
+ "%="
+ "&"
+ "&&"
+ "&="
+ "*"
+ "*="
+ "+"
+ "++"
+ "+="
+ "-"
+ "--"
+ "-="
+ "->"
+ "/"
+ "/="
+ "<"
+ "<<"
+ "<="
+ "="
+ "=="
+ ">"
+ ">="
+ ">>"
+ "@"
+ "^"
+ "^="
+ "|"
+ "|="
+ "||"
+ "~"
] @operator
+(function_declaration
+ (identifier) @function)
+
+(parameter
+ (variable_identifier_declaration
+ (identifier) @variable.parameter))
+
+(struct_declaration
+ (identifier) @type)
+
+(struct_declaration
+ (struct_member
+ (variable_identifier_declaration
+ (identifier) @variable.other.member)))
+
+(type_constructor_or_function_call_expression
+ (type_declaration (identifier) @function))
+
+(type_declaration _ @type)
+
(attribute
- (identifier) @attribute)
+ (identifier) @attribute)
-(comment) @comment
+(identifier) @variable
-(ERROR) @error
+(comment) @comment