@codingame/monaco-vscode-treesitter-service-override 14.0.5 → 15.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/assets/typescript.scm +88 -21
- package/index.js +5 -2
- package/package.json +10 -9
- package/vscode/src/vs/editor/common/model/tokenStore.d.ts +66 -0
- package/vscode/src/vs/editor/common/model/tokenStore.js +406 -0
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.d.ts +29 -0
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.js +130 -0
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.d.ts +14 -15
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.js +72 -60
- package/vscode/src/vs/editor/common/services/treeSitterParserService.d.ts +48 -0
- package/vscode/src/vs/editor/common/services/treeSitterParserService.js +36 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.d.ts +27 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.js +98 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.contribution.js +1 -1
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.d.ts +27 -11
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.js +313 -130
package/assets/typescript.scm
CHANGED
|
@@ -25,20 +25,6 @@
|
|
|
25
25
|
(regex) @string.regexp
|
|
26
26
|
(number) @constant.numeric
|
|
27
27
|
|
|
28
|
-
; Template TODO: These don't seem to be working
|
|
29
|
-
|
|
30
|
-
(template_substitution
|
|
31
|
-
"${" @punctuation.definition.template-expression.begin
|
|
32
|
-
"}" @punctuation.definition.template-expression.end)
|
|
33
|
-
|
|
34
|
-
(template_type
|
|
35
|
-
"${" @punctuation.definition.template-expression.begin
|
|
36
|
-
"}" @punctuation.definition.template-expression.end)
|
|
37
|
-
|
|
38
|
-
(type_arguments
|
|
39
|
-
"<" @punctuation.bracket
|
|
40
|
-
">" @punctuation.bracket)
|
|
41
|
-
|
|
42
28
|
; Properties
|
|
43
29
|
|
|
44
30
|
(member_expression
|
|
@@ -86,6 +72,19 @@
|
|
|
86
72
|
left: (identifier) @entity.name.function
|
|
87
73
|
right: [(function_expression) (arrow_function)])
|
|
88
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
|
+
|
|
89
88
|
; Function and method calls
|
|
90
89
|
|
|
91
90
|
(call_expression
|
|
@@ -100,6 +99,8 @@
|
|
|
100
99
|
function: (member_expression
|
|
101
100
|
property: (property_identifier) @entity.name.function))
|
|
102
101
|
|
|
102
|
+
(new_expression) @new.expr
|
|
103
|
+
|
|
103
104
|
(new_expression
|
|
104
105
|
constructor: (identifier) @entity.name.function)
|
|
105
106
|
|
|
@@ -107,8 +108,10 @@
|
|
|
107
108
|
; Special identifiers
|
|
108
109
|
|
|
109
110
|
(predefined_type) @support.type
|
|
110
|
-
(predefined_type (["string" "boolean" "number" "any"])) @support.type.primitive
|
|
111
|
+
(predefined_type (["string" "boolean" "number" "any" "unknown"])) @support.type.primitive
|
|
111
112
|
(type_identifier) @entity.name.type
|
|
113
|
+
(internal_module
|
|
114
|
+
name: (identifier) @entity.name.type.ts)
|
|
112
115
|
|
|
113
116
|
([
|
|
114
117
|
(identifier)
|
|
@@ -119,6 +122,9 @@
|
|
|
119
122
|
(extends_clause
|
|
120
123
|
value: (identifier) @entity.other.inherited-class)
|
|
121
124
|
|
|
125
|
+
(implements_clause
|
|
126
|
+
(type_identifier) @entity.other.inherited-class)
|
|
127
|
+
|
|
122
128
|
; Tokens
|
|
123
129
|
|
|
124
130
|
[
|
|
@@ -198,6 +204,36 @@
|
|
|
198
204
|
"|"
|
|
199
205
|
] @keyword.operator
|
|
200
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
|
+
|
|
201
237
|
; Keywords
|
|
202
238
|
|
|
203
239
|
("typeof") @keyword.operator.expression.typeof
|
|
@@ -270,6 +306,10 @@
|
|
|
270
306
|
"var"
|
|
271
307
|
] @storage.type
|
|
272
308
|
|
|
309
|
+
[
|
|
310
|
+
"module"
|
|
311
|
+
] @storage.type.namespace.ts
|
|
312
|
+
|
|
273
313
|
[
|
|
274
314
|
"debugger"
|
|
275
315
|
"target"
|
|
@@ -289,11 +329,14 @@
|
|
|
289
329
|
(public_field_definition
|
|
290
330
|
("?") @keyword.operator.optional)
|
|
291
331
|
|
|
292
|
-
(
|
|
332
|
+
(property_signature
|
|
333
|
+
("?") @keyword.operator.optional)
|
|
334
|
+
|
|
335
|
+
(optional_parameter
|
|
293
336
|
([
|
|
294
337
|
"?"
|
|
295
338
|
":"
|
|
296
|
-
]) @keyword.operator.optional
|
|
339
|
+
]) @keyword.operator.optional)
|
|
297
340
|
|
|
298
341
|
(ternary_expression
|
|
299
342
|
([
|
|
@@ -306,16 +349,40 @@
|
|
|
306
349
|
|
|
307
350
|
(rest_pattern) @keyword.operator.rest
|
|
308
351
|
|
|
309
|
-
(spread_element
|
|
352
|
+
(spread_element
|
|
353
|
+
("...") @keyword.operator.spread)
|
|
310
354
|
|
|
311
355
|
; Language constants
|
|
312
356
|
|
|
313
357
|
[
|
|
314
|
-
(true)
|
|
315
|
-
(false)
|
|
316
358
|
(null)
|
|
359
|
+
] @constant.language.null
|
|
360
|
+
|
|
361
|
+
[
|
|
317
362
|
(undefined)
|
|
318
|
-
] @constant.language
|
|
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)
|
|
319
386
|
|
|
320
387
|
(namespace_import
|
|
321
388
|
"*" @constant.language)
|
package/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
-
import {
|
|
3
|
+
import { TreeSitterImporter } from './vscode/src/vs/editor/common/services/treeSitterParserService.js';
|
|
4
|
+
import { ITreeSitterParserService, ITreeSitterImporter } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/treeSitterParserService.service';
|
|
4
5
|
import { TreeSitterTextModelService } from './vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.js';
|
|
5
6
|
import { ITreeSitterTokenizationFeature } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.service';
|
|
6
7
|
import { TreeSitterTokenizationFeature } from './vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.js';
|
|
7
8
|
import { registerAssets } from '@codingame/monaco-vscode-api/assets';
|
|
8
|
-
import { ITreeSitterTokenizationStoreService
|
|
9
|
+
import { ITreeSitterTokenizationStoreService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/treeSitterTokenStoreService.service';
|
|
10
|
+
import { TreeSitterTokenizationStoreService } from './vscode/src/vs/editor/common/model/treeSitterTokenStoreService.js';
|
|
9
11
|
import './vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.contribution.js';
|
|
10
12
|
|
|
11
13
|
registerAssets({
|
|
@@ -15,6 +17,7 @@ registerAssets({
|
|
|
15
17
|
});
|
|
16
18
|
function getServiceOverride() {
|
|
17
19
|
return {
|
|
20
|
+
[ITreeSitterImporter.toString()]: new SyncDescriptor(TreeSitterImporter, [], false),
|
|
18
21
|
[ITreeSitterParserService.toString()]: new SyncDescriptor(TreeSitterTextModelService, [], false),
|
|
19
22
|
[ITreeSitterTokenizationFeature.toString()]: new SyncDescriptor(TreeSitterTokenizationFeature, [], false),
|
|
20
23
|
[ITreeSitterTokenizationStoreService.toString()]: new SyncDescriptor(TreeSitterTokenizationStoreService, [], false)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-treesitter-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - treesitter service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-168b98e5-dc20-5807-b1f9-798f1f92b37f-common": "
|
|
19
|
-
"@codingame/monaco-vscode-
|
|
20
|
-
"@codingame/monaco-vscode-
|
|
21
|
-
"@
|
|
18
|
+
"@codingame/monaco-vscode-168b98e5-dc20-5807-b1f9-798f1f92b37f-common": "15.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-7ba0af96-90c2-5e11-ad7f-befdbbf246c8-common": "15.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-9d0168a3-519b-57f3-9bcc-89efc41f951a-common": "15.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-api": "15.0.0",
|
|
22
|
+
"@vscode/tree-sitter-wasm": "0.1.3"
|
|
22
23
|
},
|
|
23
24
|
"main": "index.js",
|
|
24
25
|
"module": "index.js",
|
|
@@ -28,12 +29,12 @@
|
|
|
28
29
|
"default": "./index.js"
|
|
29
30
|
},
|
|
30
31
|
"./vscode/*": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
32
|
+
"types": "./vscode/src/*.d.ts",
|
|
33
|
+
"default": "./vscode/src/*.js"
|
|
33
34
|
},
|
|
34
35
|
"./*": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
36
|
+
"types": "./*.d.ts",
|
|
37
|
+
"default": "./*.js"
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
"typesVersions": {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
3
|
+
declare class ListNode implements IDisposable {
|
|
4
|
+
readonly height: number;
|
|
5
|
+
parent?: ListNode;
|
|
6
|
+
private readonly _children;
|
|
7
|
+
get children(): ReadonlyArray<Node>;
|
|
8
|
+
private _length;
|
|
9
|
+
get length(): number;
|
|
10
|
+
constructor(height: number);
|
|
11
|
+
static create(node1: Node, node2: Node): ListNode;
|
|
12
|
+
canAppendChild(): boolean;
|
|
13
|
+
appendChild(node: Node): void;
|
|
14
|
+
private _updateParentLength;
|
|
15
|
+
unappendChild(): Node;
|
|
16
|
+
prependChild(node: Node): void;
|
|
17
|
+
unprependChild(): Node;
|
|
18
|
+
lastChild(): Node;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare enum TokenQuality {
|
|
22
|
+
None = 0,
|
|
23
|
+
ViewportGuess = 1,
|
|
24
|
+
EditGuess = 2,
|
|
25
|
+
Accurate = 3
|
|
26
|
+
}
|
|
27
|
+
type Node = ListNode | LeafNode;
|
|
28
|
+
interface LeafNode {
|
|
29
|
+
readonly length: number;
|
|
30
|
+
parent?: ListNode;
|
|
31
|
+
token: number;
|
|
32
|
+
tokenQuality: TokenQuality;
|
|
33
|
+
height: 0;
|
|
34
|
+
}
|
|
35
|
+
export interface TokenUpdate {
|
|
36
|
+
readonly startOffsetInclusive: number;
|
|
37
|
+
readonly length: number;
|
|
38
|
+
readonly token: number;
|
|
39
|
+
}
|
|
40
|
+
export declare class TokenStore implements IDisposable {
|
|
41
|
+
private readonly _textModel;
|
|
42
|
+
private _root;
|
|
43
|
+
get root(): Node;
|
|
44
|
+
constructor(_textModel: ITextModel);
|
|
45
|
+
private createEmptyRoot;
|
|
46
|
+
buildStore(tokens: TokenUpdate[], tokenQuality: TokenQuality): void;
|
|
47
|
+
private createFromUpdates;
|
|
48
|
+
update(length: number, tokens: TokenUpdate[], tokenQuality: TokenQuality): void;
|
|
49
|
+
delete(length: number, startOffset: number): void;
|
|
50
|
+
private replace;
|
|
51
|
+
private traverseInOrderInRange;
|
|
52
|
+
getTokenAt(offset: number): TokenUpdate | undefined;
|
|
53
|
+
getTokensInRange(startOffsetInclusive: number, endOffsetExclusive: number): TokenUpdate[];
|
|
54
|
+
markForRefresh(startOffsetInclusive: number, endOffsetExclusive: number): void;
|
|
55
|
+
rangeHasTokens(startOffsetInclusive: number, endOffsetExclusive: number, minimumTokenQuality: TokenQuality): boolean;
|
|
56
|
+
rangeNeedsRefresh(startOffsetInclusive: number, endOffsetExclusive: number): boolean;
|
|
57
|
+
getNeedsRefresh(): {
|
|
58
|
+
startOffset: number;
|
|
59
|
+
endOffset: number;
|
|
60
|
+
}[];
|
|
61
|
+
deepCopy(): TokenStore;
|
|
62
|
+
private _copyNodeIterative;
|
|
63
|
+
printTree(root?: Node): string;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
export {};
|