ts-wasms 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +7 -0
  2. package/index.d.ts +108 -94
  3. package/index.js +21 -0
  4. package/manifest.json +622 -0
  5. package/out/ada/folds.scm +15 -0
  6. package/out/ada/highlights.scm +196 -0
  7. package/out/ada/injections.scm +2 -0
  8. package/out/ada/locals.scm +33 -0
  9. package/out/ada/textobjects.scm +23 -0
  10. package/out/ada/tree-sitter-ada.wasm +0 -0
  11. package/out/arduino/folds.scm +1 -0
  12. package/out/arduino/highlights.scm +48 -0
  13. package/out/arduino/indents.scm +1 -0
  14. package/out/arduino/injections.scm +1 -0
  15. package/out/arduino/locals.scm +1 -0
  16. package/out/arduino/tags.scm +5 -0
  17. package/out/arduino/tree-sitter-arduino.wasm +0 -0
  18. package/out/awk/highlights.scm +122 -0
  19. package/out/awk/injections.scm +17 -0
  20. package/out/awk/tree-sitter-awk.wasm +0 -0
  21. package/out/bibtex/folds.scm +1 -0
  22. package/out/bibtex/highlights.scm +47 -0
  23. package/out/bibtex/indents.scm +8 -0
  24. package/out/bibtex/injections.scm +2 -0
  25. package/out/bibtex/locals.scm +0 -0
  26. package/out/bibtex/tags.scm +0 -0
  27. package/out/bibtex/tree-sitter-bibtex.wasm +0 -0
  28. package/out/cairo/folds.scm +26 -0
  29. package/out/cairo/highlights.scm +372 -0
  30. package/out/cairo/indents.scm +134 -0
  31. package/out/cairo/injections.scm +3 -0
  32. package/out/cairo/locals.scm +28 -0
  33. package/out/cairo/textobjects.scm +79 -0
  34. package/out/cairo/tree-sitter-cairo.wasm +0 -0
  35. package/out/cuda/folds.scm +1 -0
  36. package/out/cuda/highlights.scm +17 -0
  37. package/out/cuda/indents.scm +1 -0
  38. package/out/cuda/injections.scm +1 -0
  39. package/out/cuda/locals.scm +1 -0
  40. package/out/cuda/tree-sitter-cuda.wasm +0 -0
  41. package/out/d/folds.scm +4 -0
  42. package/out/d/helix-highlights.scm +241 -0
  43. package/out/d/helix-indents.scm +17 -0
  44. package/out/d/helix-injections.scm +2 -0
  45. package/out/d/helix-textobjects.scm +9 -0
  46. package/out/d/highlights.scm +259 -0
  47. package/out/d/indents.scm +17 -0
  48. package/out/d/injections.scm +2 -0
  49. package/out/d/locals.scm +79 -0
  50. package/out/d/nova-folds.scm +6 -0
  51. package/out/d/nova-highlights.scm +283 -0
  52. package/out/d/nova-symbols.scm +23 -0
  53. package/out/d/tags.scm +28 -0
  54. package/out/d/textobjects.scm +9 -0
  55. package/out/d/tree-sitter-d.wasm +0 -0
  56. package/out/desktop/folds.scm +1 -0
  57. package/out/desktop/highlights.scm +91 -0
  58. package/out/desktop/injections.scm +8 -0
  59. package/out/desktop/tree-sitter-desktop.wasm +0 -0
  60. package/out/devicetree/folds.scm +1 -0
  61. package/out/devicetree/highlights.scm +78 -0
  62. package/out/devicetree/indents.scm +12 -0
  63. package/out/devicetree/injections.scm +2 -0
  64. package/out/devicetree/locals.scm +4 -0
  65. package/out/devicetree/tree-sitter-devicetree.wasm +0 -0
  66. package/out/git_config/folds.scm +2 -0
  67. package/out/git_config/injections.scm +69 -0
  68. package/out/git_rebase/injections.scm +8 -0
  69. package/out/gleam/folds.scm +7 -0
  70. package/out/gleam/highlights.scm +137 -0
  71. package/out/gleam/indents.scm +28 -0
  72. package/out/gleam/injections.scm +3 -0
  73. package/out/gleam/locals.scm +17 -0
  74. package/out/gleam/tags.scm +41 -0
  75. package/out/gleam/tree-sitter-gleam.wasm +0 -0
  76. package/out/glsl/folds.scm +1 -0
  77. package/out/glsl/highlights.scm +115 -0
  78. package/out/glsl/indents.scm +1 -0
  79. package/out/glsl/injections.scm +1 -0
  80. package/out/glsl/locals.scm +1 -0
  81. package/out/glsl/tree-sitter-glsl.wasm +0 -0
  82. package/out/godot_resource/folds.scm +1 -0
  83. package/out/godot_resource/highlights.scm +49 -0
  84. package/out/godot_resource/injections.scm +2 -0
  85. package/out/godot_resource/locals.scm +1 -0
  86. package/out/kdl/folds.scm +8 -0
  87. package/out/kdl/highlights.scm +58 -0
  88. package/out/kdl/indents.scm +7 -0
  89. package/out/kdl/injections.scm +4 -0
  90. package/out/kdl/locals.scm +10 -0
  91. package/out/kdl/tree-sitter-kdl.wasm +0 -0
  92. package/out/liquid/highlights.scm +119 -0
  93. package/out/liquid/injections.scm +22 -0
  94. package/out/liquid/tree-sitter-liquid.wasm +0 -0
  95. package/out/ocaml_interface/folds.scm +1 -0
  96. package/out/ocaml_interface/indents.scm +1 -0
  97. package/out/ocaml_interface/injections.scm +1 -0
  98. package/out/php_only/folds.scm +19 -0
  99. package/out/php_only/indents.scm +68 -0
  100. package/out/php_only/locals.scm +84 -0
  101. package/out/solidity/folds.scm +20 -0
  102. package/out/solidity/highlights-nvim.scm +309 -0
  103. package/out/solidity/highlights.scm +217 -0
  104. package/out/solidity/injections.scm +14 -0
  105. package/out/solidity/locals.scm +9 -0
  106. package/out/solidity/tags.scm +43 -0
  107. package/out/solidity/tree-sitter-solidity.wasm +0 -0
  108. package/package.json +18 -2
  109. /package/out/{c-sharp → c_sharp_c_sharp}/highlights.scm +0 -0
  110. /package/out/{c-sharp → c_sharp_c_sharp}/tags.scm +0 -0
  111. /package/out/{c-sharp/tree-sitter-c-sharp.wasm → c_sharp_c_sharp/tree-sitter-c_sharp_c_sharp.wasm} +0 -0
  112. /package/out/{embedded-template → embedded_template_embedded_template}/highlights.scm +0 -0
  113. /package/out/{embedded-template → embedded_template_embedded_template}/injections-ejs.scm +0 -0
  114. /package/out/{embedded-template → embedded_template_embedded_template}/injections-erb.scm +0 -0
  115. /package/out/{embedded-template → embedded_template_embedded_template}/injections-etlua.scm +0 -0
  116. /package/out/{embedded-template/tree-sitter-embedded-template.wasm → embedded_template_embedded_template/tree-sitter-embedded_template_embedded_template.wasm} +0 -0
  117. /package/out/{git-config → git_config}/highlights.scm +0 -0
  118. /package/out/{git-config/tree-sitter-git-config.wasm → git_config/tree-sitter-git_config.wasm} +0 -0
  119. /package/out/{git-rebase → git_rebase}/highlights.scm +0 -0
  120. /package/out/{git-rebase/tree-sitter-git-rebase.wasm → git_rebase/tree-sitter-git_rebase.wasm} +0 -0
  121. /package/out/{godot-resource/tree-sitter-godot-resource.wasm → godot_resource/tree-sitter-godot_resource.wasm} +0 -0
  122. /package/out/{markdown-inline → markdown_inline}/highlights.scm +0 -0
  123. /package/out/{markdown-inline → markdown_inline}/injections.scm +0 -0
  124. /package/out/{markdown-inline/tree-sitter-markdown-inline.wasm → markdown_inline/tree-sitter-markdown_inline.wasm} +0 -0
  125. /package/out/{ocaml-interface → ocaml_interface}/highlights.scm +0 -0
  126. /package/out/{ocaml-interface → ocaml_interface}/locals.scm +0 -0
  127. /package/out/{ocaml-interface → ocaml_interface}/tags.scm +0 -0
  128. /package/out/{ocaml-interface/tree-sitter-ocaml-interface.wasm → ocaml_interface/tree-sitter-ocaml_interface.wasm} +0 -0
  129. /package/out/{ocaml-type → ocaml_type}/highlights.scm +0 -0
  130. /package/out/{ocaml-type → ocaml_type}/locals.scm +0 -0
  131. /package/out/{ocaml-type → ocaml_type}/tags.scm +0 -0
  132. /package/out/{ocaml-type/tree-sitter-ocaml-type.wasm → ocaml_type/tree-sitter-ocaml_type.wasm} +0 -0
  133. /package/out/{php-only → php_only}/highlights.scm +0 -0
  134. /package/out/{php-only → php_only}/injections-text.scm +0 -0
  135. /package/out/{php-only → php_only}/injections.scm +0 -0
  136. /package/out/{php-only → php_only}/tags.scm +0 -0
  137. /package/out/{php-only/tree-sitter-php-only.wasm → php_only/tree-sitter-php_only.wasm} +0 -0
  138. /package/out/{csv-psv → psv}/highlights.scm +0 -0
  139. /package/out/{csv-psv/tree-sitter-csv-psv.wasm → psv/tree-sitter-psv.wasm} +0 -0
  140. /package/out/{csv-tsv → tsv}/highlights.scm +0 -0
  141. /package/out/{csv-tsv/tree-sitter-csv-tsv.wasm → tsv/tree-sitter-tsv.wasm} +0 -0
@@ -0,0 +1,372 @@
1
+ ; -------
2
+ ; Tree-Sitter doesn't allow overrides in regards to captures,
3
+ ; though it is possible to affect the child node of a captured
4
+ ; node. Thus, the approach here is to flip the order so that
5
+ ; overrides are unnecessary.
6
+ ; -------
7
+
8
+ ; -------
9
+ ; Types
10
+ ; -------
11
+
12
+ (type_parameters
13
+ (type_identifier) @type.parameter)
14
+ (constrained_type_parameter
15
+ left: (type_identifier) @type.parameter)
16
+
17
+ ; ---
18
+ ; Primitives
19
+ ; ---
20
+
21
+ (primitive_type) @type.builtin
22
+ (boolean_literal) @constant.builtin.boolean
23
+ (numeric_literal) @constant.numeric.integer
24
+ [
25
+ (string_literal)
26
+ (shortstring_literal)
27
+ ] @string
28
+ [
29
+ (line_comment)
30
+ ] @comment
31
+
32
+ ; ---
33
+ ; Extraneous
34
+ ; ---
35
+
36
+ (enum_variant (identifier) @type.enum.variant)
37
+
38
+ (field_initializer
39
+ (field_identifier) @variable.other.member)
40
+ (shorthand_field_initializer
41
+ (identifier) @variable.other.member)
42
+ (shorthand_field_identifier) @variable.other.member
43
+
44
+
45
+ ; ---
46
+ ; Punctuation
47
+ ; ---
48
+
49
+ [
50
+ "::"
51
+ "."
52
+ ";"
53
+ ","
54
+ ] @punctuation.delimiter
55
+
56
+ [
57
+ "("
58
+ ")"
59
+ "["
60
+ "]"
61
+ "{"
62
+ "}"
63
+ ] @punctuation.bracket
64
+ (type_arguments
65
+ [
66
+ "<"
67
+ ">"
68
+ ] @punctuation.bracket)
69
+ (type_parameters
70
+ [
71
+ "<"
72
+ ">"
73
+ ] @punctuation.bracket)
74
+ (closure_parameters
75
+ "|" @punctuation.bracket)
76
+
77
+ ; ---
78
+ ; Variables
79
+ ; ---
80
+
81
+ (let_declaration
82
+ pattern: [
83
+ ((identifier) @variable)
84
+ ((tuple_pattern
85
+ (identifier) @variable))
86
+ ])
87
+
88
+ ; It needs to be anonymous to not conflict with `call_expression` further below.
89
+ (_
90
+ value: (field_expression
91
+ value: (identifier)? @variable
92
+ field: (field_identifier) @variable.other.member))
93
+
94
+ (parameter
95
+ pattern: (identifier) @variable.parameter)
96
+
97
+ (closure_parameters
98
+ (identifier) @variable.parameter)
99
+ ; -------
100
+ ; Keywords
101
+ ; -------
102
+
103
+ (for_expression
104
+ "for" @keyword.control.repeat)
105
+
106
+ "in" @keyword.control
107
+
108
+ [
109
+ "match"
110
+ "if"
111
+ "else"
112
+ ] @keyword.control.conditional
113
+
114
+ [
115
+ "while"
116
+ "loop"
117
+ ] @keyword.control.repeat
118
+
119
+ [
120
+ "break"
121
+ "continue"
122
+ "return"
123
+ ] @keyword.control.return
124
+
125
+ "use" @keyword.control.import
126
+ (mod_item "mod" @keyword.control.import !body)
127
+ (use_as_clause "as" @keyword.control.import)
128
+
129
+
130
+ [
131
+ (crate)
132
+ (super)
133
+ "as"
134
+ "pub"
135
+ "mod"
136
+ (extern)
137
+ (nopanic)
138
+
139
+ "impl"
140
+ "trait"
141
+ "of"
142
+
143
+ "default"
144
+ ] @keyword
145
+
146
+ [
147
+ "struct"
148
+ "enum"
149
+ "type"
150
+ ] @keyword.storage.type
151
+
152
+ "let" @keyword.storage
153
+ "fn" @keyword.function
154
+
155
+ (mutable_specifier) @keyword.storage.modifier.mut
156
+ (ref_specifier) @keyword.storage.modifier.ref
157
+
158
+ (snapshot_type "@" @keyword.storage.modifier.ref)
159
+
160
+ [
161
+ "const"
162
+ (ref_specifier)
163
+ ] @keyword.storage.modifier
164
+
165
+ ; TODO: variable.mut to highlight mutable identifiers via locals.scm
166
+
167
+ ; -------
168
+ ; Constructors
169
+ ; -------
170
+ ; TODO: this is largely guesswork, remove it once we get actual info from locals.scm or r-a
171
+
172
+ (struct_expression
173
+ name: (type_identifier) @constructor)
174
+
175
+ (tuple_enum_pattern
176
+ type: [
177
+ (identifier) @constructor
178
+ (scoped_identifier
179
+ name: (identifier) @constructor)
180
+ ])
181
+ (struct_pattern
182
+ type: [
183
+ ((type_identifier) @constructor)
184
+ (scoped_type_identifier
185
+ name: (type_identifier) @constructor)
186
+ ])
187
+ (match_pattern
188
+ ((identifier) @constructor) (#match? @constructor "^[A-Z]"))
189
+ (or_pattern
190
+ ((identifier) @constructor)
191
+ ((identifier) @constructor)
192
+ (#match? @constructor "^[A-Z]"))
193
+
194
+ ; -------
195
+ ; Guess Other Types
196
+ ; -------
197
+
198
+ ((identifier) @constant
199
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
200
+
201
+ ; ---
202
+ ; PascalCase identifiers in call_expressions (e.g. `Ok()`)
203
+ ; are assumed to be enum constructors.
204
+ ; ---
205
+
206
+ (call_expression
207
+ function: [
208
+ ((identifier) @constructor
209
+ (#match? @constructor "^[A-Z]"))
210
+ (scoped_identifier
211
+ name: ((identifier) @constructor
212
+ (#match? @constructor "^[A-Z]")))
213
+ ])
214
+
215
+ ; ---
216
+ ; PascalCase identifiers under a path which is also PascalCase
217
+ ; are assumed to be constructors if they have methods or fields.
218
+ ; ---
219
+
220
+ (field_expression
221
+ value: (scoped_identifier
222
+ path: [
223
+ (identifier) @type
224
+ (scoped_identifier
225
+ name: (identifier) @type)
226
+ ]
227
+ name: (identifier) @constructor
228
+ (#match? @type "^[A-Z]")
229
+ (#match? @constructor "^[A-Z]")))
230
+
231
+ ; ---
232
+ ; Other PascalCase identifiers are assumed to be structs.
233
+ ; ---
234
+
235
+ ((identifier) @type
236
+ (#match? @type "^[A-Z]"))
237
+
238
+ ; -------
239
+ ; Functions
240
+ ; -------
241
+
242
+ (call_expression
243
+ function: [
244
+ ((identifier) @function)
245
+ (scoped_identifier
246
+ name: (identifier) @function)
247
+ (field_expression
248
+ field: (field_identifier) @function)
249
+ ])
250
+ (generic_function
251
+ function: [
252
+ ((identifier) @function)
253
+ (scoped_identifier
254
+ name: (identifier) @function)
255
+ (field_expression
256
+ field: (field_identifier) @function.method)
257
+ ])
258
+ (function_item
259
+ (function
260
+ name: (identifier) @function))
261
+
262
+ (function_signature_item
263
+ (function
264
+ name: (identifier) @function))
265
+
266
+ (external_function_item
267
+ (function
268
+ name: (identifier) @function))
269
+
270
+ ; ---
271
+ ; Macros
272
+ ; ---
273
+
274
+ (attribute
275
+ (identifier) @special
276
+ arguments: (token_tree (identifier) @type)
277
+ (#eq? @special "derive")
278
+ )
279
+
280
+ (attribute
281
+ (identifier) @function.macro)
282
+ (attribute
283
+ [
284
+ (identifier) @function.macro
285
+ (scoped_identifier
286
+ name: (identifier) @function.macro)
287
+ ]
288
+ (token_tree (identifier) @function.macro)?)
289
+
290
+ (inner_attribute_item) @attribute
291
+
292
+ (macro_invocation
293
+ macro: [
294
+ ((identifier) @function.macro)
295
+ (scoped_identifier
296
+ name: (identifier) @function.macro)
297
+ ]
298
+ "!" @function.macro)
299
+
300
+
301
+ ; -------
302
+ ; Operators
303
+ ; -------
304
+
305
+ [
306
+ "*"
307
+ "->"
308
+ "=>"
309
+ "<="
310
+ "="
311
+ "=="
312
+ "!"
313
+ "!="
314
+ "%"
315
+ "%="
316
+ "@"
317
+ "&&"
318
+ "|"
319
+ "||"
320
+ "^"
321
+ "*"
322
+ "*="
323
+ "-"
324
+ "-="
325
+ "+"
326
+ "+="
327
+ "/"
328
+ "/="
329
+ ">"
330
+ "<"
331
+ ">="
332
+ ">>"
333
+ "<<"
334
+ ] @operator
335
+
336
+ ; -------
337
+ ; Paths
338
+ ; -------
339
+
340
+ (use_declaration
341
+ argument: (identifier) @namespace)
342
+ (use_wildcard
343
+ (identifier) @namespace)
344
+ (mod_item
345
+ name: (identifier) @namespace)
346
+ (scoped_use_list
347
+ path: (identifier)? @namespace)
348
+ (use_list
349
+ (identifier) @namespace)
350
+ (use_as_clause
351
+ path: (identifier)? @namespace
352
+ alias: (identifier) @namespace)
353
+
354
+ ; ---
355
+ ; Remaining Paths
356
+ ; ---
357
+
358
+ (scoped_identifier
359
+ path: (identifier)? @namespace
360
+ name: (identifier) @namespace)
361
+ (scoped_type_identifier
362
+ path: (identifier) @namespace)
363
+
364
+ ; -------
365
+ ; Remaining Identifiers
366
+ ; -------
367
+
368
+ "?" @special
369
+
370
+ (type_identifier) @type
371
+ (identifier) @variable
372
+ (field_identifier) @variable.other.member
@@ -0,0 +1,134 @@
1
+ [
2
+ (use_list)
3
+ (block)
4
+ (match_block)
5
+ (arguments)
6
+ (parameters)
7
+ (declaration_list)
8
+ (field_declaration_list)
9
+ (field_initializer_list)
10
+ (struct_pattern)
11
+ (tuple_pattern)
12
+ (unit_expression)
13
+ (enum_variant_list)
14
+ (call_expression)
15
+ (binary_expression)
16
+ (field_expression)
17
+ (tuple_expression)
18
+ (array_expression)
19
+
20
+ (token_tree)
21
+ ] @indent
22
+
23
+ [
24
+ "}"
25
+ "]"
26
+ ")"
27
+ ] @outdent
28
+
29
+ ; Indent the right side of assignments.
30
+ ; The #not-same-line? predicate is required to prevent an extra indent for e.g.
31
+ ; an else-clause where the previous if-clause starts on the same line as the assignment.
32
+ (assignment_expression
33
+ .
34
+ (_) @expr-start
35
+ right: (_) @indent
36
+ (#not-same-line? @indent @expr-start)
37
+ (#set! "scope" "all")
38
+ )
39
+ (compound_assignment_expr
40
+ .
41
+ (_) @expr-start
42
+ right: (_) @indent
43
+ (#not-same-line? @indent @expr-start)
44
+ (#set! "scope" "all")
45
+ )
46
+ (let_declaration
47
+ "let" @expr-start
48
+ value: (_) @indent
49
+ alternative: (_)? @indent
50
+ (#not-same-line? @indent @expr-start)
51
+ (#set! "scope" "all")
52
+ )
53
+ (let_condition
54
+ .
55
+ (_) @expr-start
56
+ value: (_) @indent
57
+ (#not-same-line? @indent @expr-start)
58
+ (#set! "scope" "all")
59
+ )
60
+ (if_expression
61
+ .
62
+ (_) @expr-start
63
+ condition: (_) @indent
64
+ (#not-same-line? @indent @expr-start)
65
+ (#set! "scope" "all")
66
+ )
67
+ (field_pattern
68
+ .
69
+ (_) @expr-start
70
+ pattern: (_) @indent
71
+ (#not-same-line? @indent @expr-start)
72
+ (#set! "scope" "all")
73
+ )
74
+ ; Indent type aliases that span multiple lines, similar to
75
+ ; regular assignment expressions
76
+ (type_item
77
+ .
78
+ (_) @expr-start
79
+ type: (_) @indent
80
+ (#not-same-line? @indent @expr-start)
81
+ (#set! "scope" "all")
82
+ )
83
+
84
+ ; Some field expressions where the left part is a multiline expression are not
85
+ ; indented by cargo fmt.
86
+ ; Because this multiline expression might be nested in an arbitrary number of
87
+ ; field expressions, this can only be matched using a Regex.
88
+ (field_expression
89
+ value: (_) @val
90
+ "." @outdent
91
+ ; Check whether the first line ends with `(`, `{` or `[` (up to whitespace).
92
+ (#match? @val "(\\A[^\\n\\r]+(\\(|\\{|\\[)[\\t ]*(\\n|\\r))")
93
+ )
94
+ ; Same as above, but with an additional `call_expression`. This is required since otherwise
95
+ ; the arguments of the function call won't be outdented.
96
+ (call_expression
97
+ function: (field_expression
98
+ value: (_) @val
99
+ "." @outdent
100
+ (#match? @val "(\\A[^\\n\\r]+(\\(|\\{|\\[)[\\t ]*(\\n|\\r))")
101
+ )
102
+ arguments: (_) @outdent
103
+ )
104
+
105
+
106
+ ; Indent if guards in patterns.
107
+ ; Since the tree-sitter grammar doesn't create a node for the if expression,
108
+ ; it's not possible to do this correctly in all cases. Indenting the tail of the
109
+ ; whole pattern whenever it contains an `if` only fails if the `if` appears after
110
+ ; the second line of the pattern (which should only rarely be the case)
111
+ (match_pattern
112
+ .
113
+ (_) @expr-start
114
+ "if" @pattern-guard
115
+ (#not-same-line? @expr-start @pattern-guard)
116
+ ) @indent
117
+
118
+ ; Align closure parameters if they span more than one line
119
+ (closure_parameters
120
+ "|"
121
+ .
122
+ (_) @anchor
123
+ (_) @expr-end
124
+ .
125
+ (#not-same-line? @anchor @expr-end)
126
+ ) @align
127
+
128
+ (for_expression
129
+ "in" @in
130
+ .
131
+ (_) @indent
132
+ (#not-same-line? @in @indent)
133
+ (#set! "scope" "all")
134
+ )
@@ -0,0 +1,3 @@
1
+ ([(line_comment)] @injection.content
2
+ (#set! injection.language "comment"))
3
+
@@ -0,0 +1,28 @@
1
+ ; Scopes
2
+
3
+ [
4
+ (function_item)
5
+ (struct_item)
6
+ (enum_item)
7
+ (type_item)
8
+ (trait_item)
9
+ (impl_item)
10
+ (closure_expression)
11
+ (block)
12
+ ] @local.scope
13
+
14
+ ; Definitions
15
+
16
+ (parameter
17
+ (identifier) @local.definition)
18
+
19
+ (type_parameters
20
+ (type_identifier) @local.definition)
21
+ (constrained_type_parameter
22
+ left: (type_identifier) @local.definition)
23
+
24
+ (closure_parameters (identifier) @local.definition)
25
+
26
+ ; References
27
+ (identifier) @local.reference
28
+ (type_identifier) @local.reference
@@ -0,0 +1,79 @@
1
+ (function_item
2
+ body: (_) @function.inside) @function.around
3
+
4
+ (closure_expression
5
+ body: (_) @function.inside) @function.around
6
+
7
+ (struct_item
8
+ body: (_) @class.inside) @class.around
9
+
10
+ (enum_item
11
+ body: (_) @class.inside) @class.around
12
+
13
+ (trait_item
14
+ body: (_) @class.inside) @class.around
15
+
16
+ (impl_item
17
+ body: (_) @class.inside) @class.around
18
+
19
+ (parameters
20
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
21
+
22
+ (closure_parameters
23
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
24
+
25
+ (type_parameters
26
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
27
+
28
+ (type_arguments
29
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
30
+
31
+ (arguments
32
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
33
+
34
+ (field_initializer_list
35
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
36
+
37
+ [
38
+ (line_comment)
39
+ ] @comment.inside
40
+
41
+ (line_comment)+ @comment.around
42
+
43
+ (; #[test]
44
+ (attribute_item
45
+ (attribute
46
+ (identifier) @_test_attribute))
47
+ ; allow other attributes like #[should_panic] and comments
48
+ [
49
+ (attribute_item)
50
+ (line_comment)
51
+ ]*
52
+ ; the test function
53
+ (function_item
54
+ body: (_) @test.inside) @test.around
55
+ (#eq? @_test_attribute "test"))
56
+
57
+ (array_expression
58
+ (_) @entry.around)
59
+
60
+ (tuple_expression
61
+ (_) @entry.around)
62
+
63
+ (tuple_pattern
64
+ (_) @entry.around)
65
+
66
+ ; Commonly used vec macro intializer is special cased
67
+ (macro_invocation
68
+ (identifier) @_id (token_tree (_) @entry.around)
69
+ (#eq? @_id "array"))
70
+
71
+ (enum_variant) @entry.around
72
+
73
+ (field_declaration
74
+ (_) @entry.inside) @entry.around
75
+
76
+ (field_initializer
77
+ (_) @entry.inside) @entry.around
78
+
79
+ (shorthand_field_initializer) @entry.around
Binary file
@@ -0,0 +1 @@
1
+ ; inherits: cpp
@@ -0,0 +1,17 @@
1
+ ; inherits: cpp
2
+
3
+ [
4
+ "<<<"
5
+ ">>>"
6
+ ] @punctuation.bracket
7
+
8
+ [
9
+ "__host__"
10
+ "__device__"
11
+ "__global__"
12
+ "__managed__"
13
+ "__forceinline__"
14
+ "__noinline__"
15
+ ] @keyword.modifier
16
+
17
+ "__launch_bounds__" @keyword.modifier
@@ -0,0 +1 @@
1
+ ; inherits: cpp
@@ -0,0 +1 @@
1
+ ; inherits: cpp
@@ -0,0 +1 @@
1
+ ; inherits: cpp
Binary file
@@ -0,0 +1,4 @@
1
+ [
2
+ (block_statement)
3
+ (aggregate_body)
4
+ ] @fold