@codingame/monaco-vscode-treesitter-service-override 15.0.2 → 16.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.
- package/index.js +1 -1
- package/package.json +9 -6
- package/vscode/src/vs/editor/common/languages/highlights/typescript.scm +488 -0
- package/vscode/src/vs/editor/common/model/tokenStore.d.ts +0 -1
- package/vscode/src/vs/editor/common/model/tokenStore.js +14 -8
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.d.ts +3 -0
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.js +33 -27
- package/vscode/src/vs/editor/common/services/treeSitter/cursorUtils.d.ts +6 -0
- package/vscode/src/vs/editor/common/services/treeSitter/cursorUtils.js +76 -0
- package/vscode/src/vs/editor/common/services/treeSitter/textModelTreeSitter.d.ts +88 -0
- package/vscode/src/vs/editor/common/services/treeSitter/textModelTreeSitter.js +675 -0
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterLanguages.d.ts +30 -0
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterLanguages.js +102 -0
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.d.ts +8 -80
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.js +20 -522
- package/vscode/src/vs/editor/common/services/treeSitterParserService.d.ts +16 -3
- package/vscode/src/vs/editor/common/services/treeSitterParserService.js +1 -1
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.d.ts +7 -2
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.js +43 -22
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.d.ts +14 -14
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.js +256 -169
- package/assets/typescript.scm +0 -388
package/assets/typescript.scm
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
; Order matters! Place lower precedence first.
|
|
2
|
-
; Adapted from https://github.com/zed-industries/zed/blob/main/crates/languages/src/typescript/highlights.scm
|
|
3
|
-
|
|
4
|
-
; Variables
|
|
5
|
-
|
|
6
|
-
(identifier) @variable
|
|
7
|
-
|
|
8
|
-
; Literals
|
|
9
|
-
|
|
10
|
-
(this) @variable.language.this
|
|
11
|
-
(super) @variable.language.super
|
|
12
|
-
|
|
13
|
-
(comment) @comment
|
|
14
|
-
|
|
15
|
-
; TODO: This doesn't seem to be working
|
|
16
|
-
(escape_sequence) @constant.character.escape
|
|
17
|
-
|
|
18
|
-
[
|
|
19
|
-
(string)
|
|
20
|
-
(template_string)
|
|
21
|
-
(template_literal_type)
|
|
22
|
-
] @string
|
|
23
|
-
|
|
24
|
-
; NOTE: the typescript grammar doesn't break regex into nice parts so as to capture parts of it separately
|
|
25
|
-
(regex) @string.regexp
|
|
26
|
-
(number) @constant.numeric
|
|
27
|
-
|
|
28
|
-
; Properties
|
|
29
|
-
|
|
30
|
-
(member_expression
|
|
31
|
-
object: (this)
|
|
32
|
-
property: (property_identifier) @variable)
|
|
33
|
-
|
|
34
|
-
(member_expression
|
|
35
|
-
property: (property_identifier) @variable.other.constant
|
|
36
|
-
(#match? @variable.other.constant "^[A-Z][A-Z_]+$"))
|
|
37
|
-
|
|
38
|
-
[
|
|
39
|
-
(property_identifier)
|
|
40
|
-
(shorthand_property_identifier)
|
|
41
|
-
(shorthand_property_identifier_pattern)] @variable
|
|
42
|
-
|
|
43
|
-
; Function and method definitions
|
|
44
|
-
|
|
45
|
-
(function_expression
|
|
46
|
-
name: (identifier) @entity.name.function)
|
|
47
|
-
(function_declaration
|
|
48
|
-
name: (identifier) @entity.name.function)
|
|
49
|
-
(method_definition
|
|
50
|
-
name: (property_identifier) @meta.definition.method @entity.name.function
|
|
51
|
-
(#not-eq? @entity.name.function "constructor"))
|
|
52
|
-
(method_definition
|
|
53
|
-
name: (property_identifier) @meta.definition.method @storage.type
|
|
54
|
-
(#eq? @storage.type "constructor"))
|
|
55
|
-
(method_signature
|
|
56
|
-
name: (property_identifier) @meta.definition.method @entity.name.function)
|
|
57
|
-
|
|
58
|
-
(pair
|
|
59
|
-
key: (property_identifier) @entity.name.function
|
|
60
|
-
value: [(function_expression) (arrow_function)])
|
|
61
|
-
|
|
62
|
-
(assignment_expression
|
|
63
|
-
left: (member_expression
|
|
64
|
-
property: (property_identifier) @entity.name.function)
|
|
65
|
-
right: [(function_expression) (arrow_function)])
|
|
66
|
-
|
|
67
|
-
(variable_declarator
|
|
68
|
-
name: (identifier) @entity.name.function
|
|
69
|
-
value: [(function_expression) (arrow_function)])
|
|
70
|
-
|
|
71
|
-
(assignment_expression
|
|
72
|
-
left: (identifier) @entity.name.function
|
|
73
|
-
right: [(function_expression) (arrow_function)])
|
|
74
|
-
|
|
75
|
-
(required_parameter
|
|
76
|
-
(identifier) @variable.parameter)
|
|
77
|
-
|
|
78
|
-
(required_parameter
|
|
79
|
-
(rest_pattern
|
|
80
|
-
(identifier) @variable.parameter))
|
|
81
|
-
|
|
82
|
-
(optional_parameter
|
|
83
|
-
(identifier) @variable.parameter)
|
|
84
|
-
|
|
85
|
-
(catch_clause
|
|
86
|
-
parameter: (identifier) @variable.parameter)
|
|
87
|
-
|
|
88
|
-
; Function and method calls
|
|
89
|
-
|
|
90
|
-
(call_expression
|
|
91
|
-
function: (identifier) @entity.name.function)
|
|
92
|
-
|
|
93
|
-
(call_expression
|
|
94
|
-
function: (member_expression
|
|
95
|
-
object: (identifier) @support.class.promise)
|
|
96
|
-
(#eq? @support.class.promise "Promise"))
|
|
97
|
-
|
|
98
|
-
(call_expression
|
|
99
|
-
function: (member_expression
|
|
100
|
-
property: (property_identifier) @entity.name.function))
|
|
101
|
-
|
|
102
|
-
(new_expression) @new.expr
|
|
103
|
-
|
|
104
|
-
(new_expression
|
|
105
|
-
constructor: (identifier) @entity.name.function)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
; Special identifiers
|
|
109
|
-
|
|
110
|
-
(predefined_type) @support.type
|
|
111
|
-
(predefined_type (["string" "boolean" "number" "any" "unknown"])) @support.type.primitive
|
|
112
|
-
(type_identifier) @entity.name.type
|
|
113
|
-
(internal_module
|
|
114
|
-
name: (identifier) @entity.name.type.ts)
|
|
115
|
-
|
|
116
|
-
([
|
|
117
|
-
(identifier)
|
|
118
|
-
(shorthand_property_identifier)
|
|
119
|
-
(shorthand_property_identifier_pattern)] @variable.other.constant
|
|
120
|
-
(#match? @variable.other.constant "^[A-Z][A-Z_]+$"))
|
|
121
|
-
|
|
122
|
-
(extends_clause
|
|
123
|
-
value: (identifier) @entity.other.inherited-class)
|
|
124
|
-
|
|
125
|
-
(implements_clause
|
|
126
|
-
(type_identifier) @entity.other.inherited-class)
|
|
127
|
-
|
|
128
|
-
; Tokens
|
|
129
|
-
|
|
130
|
-
[
|
|
131
|
-
";"
|
|
132
|
-
"?."
|
|
133
|
-
"."
|
|
134
|
-
","
|
|
135
|
-
":"
|
|
136
|
-
"?"
|
|
137
|
-
] @punctuation.delimiter
|
|
138
|
-
|
|
139
|
-
[
|
|
140
|
-
"!"
|
|
141
|
-
"~"
|
|
142
|
-
"==="
|
|
143
|
-
"!=="
|
|
144
|
-
"&&"
|
|
145
|
-
"||"
|
|
146
|
-
"??"
|
|
147
|
-
] @keyword.operator.logical
|
|
148
|
-
|
|
149
|
-
(binary_expression ([
|
|
150
|
-
"-"
|
|
151
|
-
"+"
|
|
152
|
-
"*"
|
|
153
|
-
"/"
|
|
154
|
-
"%"
|
|
155
|
-
"^"
|
|
156
|
-
]) @keyword.operator.arithmetic)
|
|
157
|
-
|
|
158
|
-
(binary_expression ([
|
|
159
|
-
"<"
|
|
160
|
-
"<="
|
|
161
|
-
">"
|
|
162
|
-
">="
|
|
163
|
-
]) @keyword.operator.relational)
|
|
164
|
-
|
|
165
|
-
[
|
|
166
|
-
"="
|
|
167
|
-
] @keyword.operator.assignment
|
|
168
|
-
|
|
169
|
-
(augmented_assignment_expression ([
|
|
170
|
-
"-="
|
|
171
|
-
"+="
|
|
172
|
-
"*="
|
|
173
|
-
"/="
|
|
174
|
-
"%="
|
|
175
|
-
"^="
|
|
176
|
-
"&="
|
|
177
|
-
"|="
|
|
178
|
-
"&&="
|
|
179
|
-
"||="
|
|
180
|
-
"??="
|
|
181
|
-
]) @keyword.operator.assignment.compound)
|
|
182
|
-
|
|
183
|
-
[
|
|
184
|
-
"++"
|
|
185
|
-
] @keyword.operator.increment
|
|
186
|
-
|
|
187
|
-
[
|
|
188
|
-
"--"
|
|
189
|
-
] @keyword.operator.decrement
|
|
190
|
-
|
|
191
|
-
[
|
|
192
|
-
"**"
|
|
193
|
-
"**="
|
|
194
|
-
"<<"
|
|
195
|
-
"<<="
|
|
196
|
-
"=="
|
|
197
|
-
"!="
|
|
198
|
-
">>"
|
|
199
|
-
">>="
|
|
200
|
-
">>>"
|
|
201
|
-
">>>="
|
|
202
|
-
"~"
|
|
203
|
-
"&"
|
|
204
|
-
"|"
|
|
205
|
-
] @keyword.operator
|
|
206
|
-
|
|
207
|
-
(union_type
|
|
208
|
-
("|") @keyword.operator.type)
|
|
209
|
-
|
|
210
|
-
(intersection_type
|
|
211
|
-
("&") @keyword.operator.type)
|
|
212
|
-
|
|
213
|
-
(type_annotation
|
|
214
|
-
(":") @keyword.operator.type.annotation)
|
|
215
|
-
|
|
216
|
-
[
|
|
217
|
-
"{"
|
|
218
|
-
"}"
|
|
219
|
-
"("
|
|
220
|
-
")"
|
|
221
|
-
"["
|
|
222
|
-
"]"
|
|
223
|
-
] @punctuation
|
|
224
|
-
|
|
225
|
-
(template_substitution
|
|
226
|
-
"${" @punctuation.definition.template-expression.begin
|
|
227
|
-
"}" @punctuation.definition.template-expression.end)
|
|
228
|
-
|
|
229
|
-
(template_type
|
|
230
|
-
"${" @punctuation.definition.template-expression.begin
|
|
231
|
-
"}" @punctuation.definition.template-expression.end)
|
|
232
|
-
|
|
233
|
-
(type_arguments
|
|
234
|
-
"<" @punctuation.definition.typeparameters
|
|
235
|
-
">" @punctuation.definition.typeparameters)
|
|
236
|
-
|
|
237
|
-
; Keywords
|
|
238
|
-
|
|
239
|
-
("typeof") @keyword.operator.expression.typeof
|
|
240
|
-
|
|
241
|
-
(binary_expression "instanceof" @keyword.operator.expression.instanceof)
|
|
242
|
-
|
|
243
|
-
("of") @keyword.operator.expression.of
|
|
244
|
-
|
|
245
|
-
("is") @keyword.operator.expression.is
|
|
246
|
-
|
|
247
|
-
[
|
|
248
|
-
"delete"
|
|
249
|
-
"in"
|
|
250
|
-
"infer"
|
|
251
|
-
"keyof"
|
|
252
|
-
] @keyword.operator.expression
|
|
253
|
-
|
|
254
|
-
[
|
|
255
|
-
"as"
|
|
256
|
-
"await"
|
|
257
|
-
"break"
|
|
258
|
-
"case"
|
|
259
|
-
"catch"
|
|
260
|
-
"continue"
|
|
261
|
-
"default"
|
|
262
|
-
"do"
|
|
263
|
-
"else"
|
|
264
|
-
"export"
|
|
265
|
-
"finally"
|
|
266
|
-
"for"
|
|
267
|
-
"from"
|
|
268
|
-
"if"
|
|
269
|
-
"import"
|
|
270
|
-
"require"
|
|
271
|
-
"return"
|
|
272
|
-
"satisfies"
|
|
273
|
-
"switch"
|
|
274
|
-
"throw"
|
|
275
|
-
"try"
|
|
276
|
-
"type"
|
|
277
|
-
"while"
|
|
278
|
-
"yield"
|
|
279
|
-
] @keyword.control
|
|
280
|
-
|
|
281
|
-
[
|
|
282
|
-
"abstract"
|
|
283
|
-
"async"
|
|
284
|
-
"declare"
|
|
285
|
-
"extends"
|
|
286
|
-
"implements"
|
|
287
|
-
"override"
|
|
288
|
-
"private"
|
|
289
|
-
"protected"
|
|
290
|
-
"public"
|
|
291
|
-
"readonly"
|
|
292
|
-
"static"
|
|
293
|
-
] @storage.modifier
|
|
294
|
-
|
|
295
|
-
[
|
|
296
|
-
"=>"
|
|
297
|
-
"class"
|
|
298
|
-
"const"
|
|
299
|
-
"enum"
|
|
300
|
-
"function"
|
|
301
|
-
"get"
|
|
302
|
-
"interface"
|
|
303
|
-
"let"
|
|
304
|
-
"namespace"
|
|
305
|
-
"set"
|
|
306
|
-
"var"
|
|
307
|
-
] @storage.type
|
|
308
|
-
|
|
309
|
-
[
|
|
310
|
-
"module"
|
|
311
|
-
] @storage.type.namespace.ts
|
|
312
|
-
|
|
313
|
-
[
|
|
314
|
-
"debugger"
|
|
315
|
-
"target"
|
|
316
|
-
"with"
|
|
317
|
-
] @keyword
|
|
318
|
-
|
|
319
|
-
(regex_flags) @keyword
|
|
320
|
-
|
|
321
|
-
[
|
|
322
|
-
"void"
|
|
323
|
-
] @support.type.primitive
|
|
324
|
-
|
|
325
|
-
[
|
|
326
|
-
"new"
|
|
327
|
-
] @keyword.operator.new
|
|
328
|
-
|
|
329
|
-
(public_field_definition
|
|
330
|
-
("?") @keyword.operator.optional)
|
|
331
|
-
|
|
332
|
-
(property_signature
|
|
333
|
-
("?") @keyword.operator.optional)
|
|
334
|
-
|
|
335
|
-
(optional_parameter
|
|
336
|
-
([
|
|
337
|
-
"?"
|
|
338
|
-
":"
|
|
339
|
-
]) @keyword.operator.optional)
|
|
340
|
-
|
|
341
|
-
(ternary_expression
|
|
342
|
-
([
|
|
343
|
-
"?"
|
|
344
|
-
":"
|
|
345
|
-
]) @keyword.operator.ternary)
|
|
346
|
-
|
|
347
|
-
(optional_chain
|
|
348
|
-
("?.") @punctuation.accessor.optional)
|
|
349
|
-
|
|
350
|
-
(rest_pattern) @keyword.operator.rest
|
|
351
|
-
|
|
352
|
-
(spread_element
|
|
353
|
-
("...") @keyword.operator.spread)
|
|
354
|
-
|
|
355
|
-
; Language constants
|
|
356
|
-
|
|
357
|
-
[
|
|
358
|
-
(null)
|
|
359
|
-
] @constant.language.null
|
|
360
|
-
|
|
361
|
-
[
|
|
362
|
-
(undefined)
|
|
363
|
-
] @constant.language.undefined
|
|
364
|
-
|
|
365
|
-
((identifier) @constant.language.nan
|
|
366
|
-
(#eq? @constant.language.nan "NaN"))
|
|
367
|
-
|
|
368
|
-
((identifier) @constant.language.infinity
|
|
369
|
-
(#eq? @constant.language.infinity "Infinity"))
|
|
370
|
-
|
|
371
|
-
[
|
|
372
|
-
(true)
|
|
373
|
-
] @constant.language.boolean.true
|
|
374
|
-
|
|
375
|
-
[
|
|
376
|
-
(false)
|
|
377
|
-
] @constant.language.boolean.false
|
|
378
|
-
|
|
379
|
-
(literal_type
|
|
380
|
-
[
|
|
381
|
-
(null)
|
|
382
|
-
(undefined)
|
|
383
|
-
(true)
|
|
384
|
-
(false)
|
|
385
|
-
] @support.type.builtin)
|
|
386
|
-
|
|
387
|
-
(namespace_import
|
|
388
|
-
"*" @constant.language)
|