on master help sign in
Fix & Tweak Rust's Syntax Highlighting (#5238)
c4263d6Chickenkeeper
runtime/queries/rust/highlights.scm+8−23
@@ -45,7 +45,8 @@
45 "'" @label
45 "'" @label
46 (identifier) @label)
46 (identifier) @label)
47(loop_label
47(loop_label
48+ "'" @label
48− (identifier) @type)
49+ (identifier) @label)
49
50
50; ---
51; ---
51; Punctuation
52; Punctuation
@@ -102,8 +103,6 @@
102(closure_parameters
103(closure_parameters
103 (identifier) @variable.parameter)
104 (identifier) @variable.parameter)
104
105
105−
106−
107; -------
106; -------
108; Keywords
107; Keywords
109; -------
108; -------
@@ -129,9 +128,7 @@
129[
128[
130 "break"
129 "break"
131 "continue"
130 "continue"
132−
133 "return"
131 "return"
134−
135 "await"
132 "await"
136] @keyword.control.return
133] @keyword.control.return
137
134
@@ -154,10 +151,7 @@
154 "trait"
151 "trait"
155 "for"
152 "for"
156
153
157− "unsafe"
158 "default"
154 "default"
159− "macro_rules!"
160−
161 "async"
155 "async"
162] @keyword
156] @keyword
163
157
@@ -165,13 +159,13 @@
165 "struct"
159 "struct"
166 "enum"
160 "enum"
167 "union"
161 "union"
168−
169 "type"
162 "type"
170] @keyword.storage.type
163] @keyword.storage.type
171
164
172"let" @keyword.storage
165"let" @keyword.storage
173−
174"fn" @keyword.function
166"fn" @keyword.function
167+"unsafe" @keyword.special
168+"macro_rules!" @function.macro
175
169
176(mutable_specifier) @keyword.storage.modifier.mut
170(mutable_specifier) @keyword.storage.modifier.mut
177
171
@@ -202,11 +196,11 @@
202
196
203(call_expression
197(call_expression
204 function: [
198 function: [
205− ((identifier) @type.variant
199+ ((identifier) @type.enum.variant
206− (#match? @type.variant "^[A-Z]"))
200+ (#match? @type.enum.variant "^[A-Z]"))
207 (scoped_identifier
201 (scoped_identifier
208− name: ((identifier) @type.variant
202+ name: ((identifier) @type.enum.variant
209− (#match? @type.variant "^[A-Z]")))
203+ (#match? @type.enum.variant "^[A-Z]")))
210 ])
204 ])
211
205
212; ---
206; ---
@@ -237,8 +231,6 @@
237((identifier) @type
231((identifier) @type
238 (#match? @type "^[A-Z]"))
232 (#match? @type "^[A-Z]"))
239
233
240−
241−
242(attribute
234(attribute
243 (identifier) @_macro
235 (identifier) @_macro
244 arguments: (token_tree (identifier) @constant.numeric.integer)
236 arguments: (token_tree (identifier) @constant.numeric.integer)
@@ -246,7 +238,6 @@
246)
238)
247@special
239@special
248
240
249−
250; -------
241; -------
251; Functions
242; Functions
252; -------
243; -------
@@ -303,8 +294,6 @@
303(metavariable) @variable.parameter
294(metavariable) @variable.parameter
304(fragment_specifier) @type
295(fragment_specifier) @type
305
296
306−
307−
308; -------
297; -------
309; Operators
298; Operators
310; -------
299; -------
@@ -350,8 +339,6 @@
350 "'"
339 "'"
351] @operator
340] @operator
352
341
353−
354−
355; -------
342; -------
356; Paths
343; Paths
357; -------
344; -------
@@ -382,8 +369,6 @@
382(scoped_type_identifier
369(scoped_type_identifier
383 path: (identifier) @namespace)
370 path: (identifier) @namespace)
384
371
385−
386−
387; -------
372; -------
388; Remaining Identifiers
373; Remaining Identifiers
389; -------
374; -------