@codingame/monaco-vscode-textmate-service-override 2.1.4 → 2.2.0-next.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-textmate-service-override",
3
- "version": "2.1.4",
3
+ "version": "2.2.0-next.2",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,11 +18,11 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@2.1.4",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@2.2.0-next.2",
22
22
  "vscode-marked": "npm:marked@=3.0.2",
23
23
  "vscode-oniguruma": "1.7.0",
24
24
  "vscode-textmate": "9.0.0",
25
- "@codingame/monaco-vscode-files-service-override": "2.1.4"
25
+ "@codingame/monaco-vscode-files-service-override": "2.2.0-next.2"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
package/textmate.js CHANGED
@@ -4,7 +4,7 @@ import { ITextMateTokenizationService } from 'vscode/vscode/vs/workbench/service
4
4
  export { ITextMateTokenizationService } from 'vscode/vscode/vs/workbench/services/textMate/browser/textMateTokenizationFeature';
5
5
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
6
6
  import { TextMateTokenizationFeature } from './vscode/src/vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl.js';
7
- import { TokenClassificationExtensionPoints } from './vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js';
7
+ import { TokenClassificationExtensionPoints } from 'vscode/vscode/vs/workbench/services/themes/common/tokenClassificationExtensionPoint';
8
8
  import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
9
9
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
10
  import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
@@ -24,7 +24,7 @@ import { TextMateTokenizationSupport } from './tokenizationSupport/textMateToken
24
24
  import { TokenizationSupportWithLineLimit } from './tokenizationSupport/tokenizationSupportWithLineLimit.js';
25
25
  import { ThreadedBackgroundTokenizerFactory } from './backgroundTokenization/threadedBackgroundTokenizerFactory.js';
26
26
  import { TMGrammarFactory, missingTMGrammarErrorMessage } from '../common/TMGrammarFactory.js';
27
- import { grammarsExtPoint } from '../common/TMGrammars.js';
27
+ import { grammarsExtPoint } from 'vscode/vscode/vs/workbench/services/textMate/common/TMGrammars';
28
28
  import { IWorkbenchThemeService } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
29
29
  import * as vscodeTextmate from 'vscode-textmate';
30
30
  import * as vscodeOniguruma from 'vscode-oniguruma';
@@ -1,104 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
3
- import { languagesExtPoint } from 'vscode/vscode/vs/workbench/services/language/common/languageService';
4
-
5
- const grammarsExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
6
- extensionPoint: 'grammars',
7
- deps: [languagesExtPoint],
8
- jsonSchema: {
9
- description: ( localizeWithPath(
10
- 'vs/workbench/services/textMate/common/TMGrammars',
11
- 'vscode.extension.contributes.grammars',
12
- 'Contributes textmate tokenizers.'
13
- )),
14
- type: 'array',
15
- defaultSnippets: [{ body: [{ language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' }] }],
16
- items: {
17
- type: 'object',
18
- defaultSnippets: [{ body: { language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' } }],
19
- properties: {
20
- language: {
21
- description: ( localizeWithPath(
22
- 'vs/workbench/services/textMate/common/TMGrammars',
23
- 'vscode.extension.contributes.grammars.language',
24
- 'Language identifier for which this syntax is contributed to.'
25
- )),
26
- type: 'string'
27
- },
28
- scopeName: {
29
- description: ( localizeWithPath(
30
- 'vs/workbench/services/textMate/common/TMGrammars',
31
- 'vscode.extension.contributes.grammars.scopeName',
32
- 'Textmate scope name used by the tmLanguage file.'
33
- )),
34
- type: 'string'
35
- },
36
- path: {
37
- description: ( localizeWithPath(
38
- 'vs/workbench/services/textMate/common/TMGrammars',
39
- 'vscode.extension.contributes.grammars.path',
40
- 'Path of the tmLanguage file. The path is relative to the extension folder and typically starts with \'./syntaxes/\'.'
41
- )),
42
- type: 'string'
43
- },
44
- embeddedLanguages: {
45
- description: ( localizeWithPath(
46
- 'vs/workbench/services/textMate/common/TMGrammars',
47
- 'vscode.extension.contributes.grammars.embeddedLanguages',
48
- 'A map of scope name to language id if this grammar contains embedded languages.'
49
- )),
50
- type: 'object'
51
- },
52
- tokenTypes: {
53
- description: ( localizeWithPath(
54
- 'vs/workbench/services/textMate/common/TMGrammars',
55
- 'vscode.extension.contributes.grammars.tokenTypes',
56
- 'A map of scope name to token types.'
57
- )),
58
- type: 'object',
59
- additionalProperties: {
60
- enum: ['string', 'comment', 'other']
61
- }
62
- },
63
- injectTo: {
64
- description: ( localizeWithPath(
65
- 'vs/workbench/services/textMate/common/TMGrammars',
66
- 'vscode.extension.contributes.grammars.injectTo',
67
- 'List of language scope names to which this grammar is injected to.'
68
- )),
69
- type: 'array',
70
- items: {
71
- type: 'string'
72
- }
73
- },
74
- balancedBracketScopes: {
75
- description: ( localizeWithPath(
76
- 'vs/workbench/services/textMate/common/TMGrammars',
77
- 'vscode.extension.contributes.grammars.balancedBracketScopes',
78
- 'Defines which scope names contain balanced brackets.'
79
- )),
80
- type: 'array',
81
- items: {
82
- type: 'string'
83
- },
84
- default: ['*'],
85
- },
86
- unbalancedBracketScopes: {
87
- description: ( localizeWithPath(
88
- 'vs/workbench/services/textMate/common/TMGrammars',
89
- 'vscode.extension.contributes.grammars.unbalancedBracketScopes',
90
- 'Defines which scope names do not contain balanced brackets.'
91
- )),
92
- type: 'array',
93
- items: {
94
- type: 'string'
95
- },
96
- default: [],
97
- },
98
- },
99
- required: ['scopeName', 'path']
100
- }
101
- }
102
- }));
103
-
104
- export { grammarsExtPoint };
@@ -1,298 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
3
- import { getTokenClassificationRegistry, typeAndModifierIdPattern } from 'vscode/vscode/vs/platform/theme/common/tokenClassificationRegistry';
4
-
5
- const tokenClassificationRegistry = getTokenClassificationRegistry();
6
- const tokenTypeExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
7
- extensionPoint: 'semanticTokenTypes',
8
- jsonSchema: {
9
- description: ( localizeWithPath(
10
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
11
- 'contributes.semanticTokenTypes',
12
- 'Contributes semantic token types.'
13
- )),
14
- type: 'array',
15
- items: {
16
- type: 'object',
17
- properties: {
18
- id: {
19
- type: 'string',
20
- description: ( localizeWithPath(
21
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
22
- 'contributes.semanticTokenTypes.id',
23
- 'The identifier of the semantic token type'
24
- )),
25
- pattern: typeAndModifierIdPattern,
26
- patternErrorMessage: ( localizeWithPath(
27
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
28
- 'contributes.semanticTokenTypes.id.format',
29
- 'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
30
- )),
31
- },
32
- superType: {
33
- type: 'string',
34
- description: ( localizeWithPath(
35
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
36
- 'contributes.semanticTokenTypes.superType',
37
- 'The super type of the semantic token type'
38
- )),
39
- pattern: typeAndModifierIdPattern,
40
- patternErrorMessage: ( localizeWithPath(
41
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
42
- 'contributes.semanticTokenTypes.superType.format',
43
- 'Super types should be in the form letterOrDigit[_-letterOrDigit]*'
44
- )),
45
- },
46
- description: {
47
- type: 'string',
48
- description: ( localizeWithPath(
49
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
50
- 'contributes.color.description',
51
- 'The description of the semantic token type'
52
- )),
53
- }
54
- }
55
- }
56
- }
57
- }));
58
- const tokenModifierExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
59
- extensionPoint: 'semanticTokenModifiers',
60
- jsonSchema: {
61
- description: ( localizeWithPath(
62
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
63
- 'contributes.semanticTokenModifiers',
64
- 'Contributes semantic token modifiers.'
65
- )),
66
- type: 'array',
67
- items: {
68
- type: 'object',
69
- properties: {
70
- id: {
71
- type: 'string',
72
- description: ( localizeWithPath(
73
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
74
- 'contributes.semanticTokenModifiers.id',
75
- 'The identifier of the semantic token modifier'
76
- )),
77
- pattern: typeAndModifierIdPattern,
78
- patternErrorMessage: ( localizeWithPath(
79
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
80
- 'contributes.semanticTokenModifiers.id.format',
81
- 'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
82
- ))
83
- },
84
- description: {
85
- type: 'string',
86
- description: ( localizeWithPath(
87
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
88
- 'contributes.semanticTokenModifiers.description',
89
- 'The description of the semantic token modifier'
90
- ))
91
- }
92
- }
93
- }
94
- }
95
- }));
96
- const tokenStyleDefaultsExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
97
- extensionPoint: 'semanticTokenScopes',
98
- jsonSchema: {
99
- description: ( localizeWithPath(
100
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
101
- 'contributes.semanticTokenScopes',
102
- 'Contributes semantic token scope maps.'
103
- )),
104
- type: 'array',
105
- items: {
106
- type: 'object',
107
- properties: {
108
- language: {
109
- description: ( localizeWithPath(
110
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
111
- 'contributes.semanticTokenScopes.languages',
112
- 'Lists the languge for which the defaults are.'
113
- )),
114
- type: 'string'
115
- },
116
- scopes: {
117
- description: ( localizeWithPath(
118
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
119
- 'contributes.semanticTokenScopes.scopes',
120
- 'Maps a semantic token (described by semantic token selector) to one or more textMate scopes used to represent that token.'
121
- )),
122
- type: 'object',
123
- additionalProperties: {
124
- type: 'array',
125
- items: {
126
- type: 'string'
127
- }
128
- }
129
- }
130
- }
131
- }
132
- }
133
- }));
134
- class TokenClassificationExtensionPoints {
135
- constructor() {
136
- function validateTypeOrModifier(contribution, extensionPoint, collector) {
137
- if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
138
- collector.error(( localizeWithPath(
139
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
140
- 'invalid.id',
141
- "'configuration.{0}.id' must be defined and can not be empty",
142
- extensionPoint
143
- )));
144
- return false;
145
- }
146
- if (!contribution.id.match(typeAndModifierIdPattern)) {
147
- collector.error(( localizeWithPath(
148
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
149
- 'invalid.id.format',
150
- "'configuration.{0}.id' must follow the pattern letterOrDigit[-_letterOrDigit]*",
151
- extensionPoint
152
- )));
153
- return false;
154
- }
155
- const superType = contribution.superType;
156
- if (superType && !superType.match(typeAndModifierIdPattern)) {
157
- collector.error(( localizeWithPath(
158
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
159
- 'invalid.superType.format',
160
- "'configuration.{0}.superType' must follow the pattern letterOrDigit[-_letterOrDigit]*",
161
- extensionPoint
162
- )));
163
- return false;
164
- }
165
- if (typeof contribution.description !== 'string' || contribution.id.length === 0) {
166
- collector.error(( localizeWithPath(
167
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
168
- 'invalid.description',
169
- "'configuration.{0}.description' must be defined and can not be empty",
170
- extensionPoint
171
- )));
172
- return false;
173
- }
174
- return true;
175
- }
176
- tokenTypeExtPoint.setHandler((extensions, delta) => {
177
- for (const extension of delta.added) {
178
- const extensionValue = extension.value;
179
- const collector = extension.collector;
180
- if (!extensionValue || !Array.isArray(extensionValue)) {
181
- collector.error(( localizeWithPath(
182
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
183
- 'invalid.semanticTokenTypeConfiguration',
184
- "'configuration.semanticTokenType' must be an array"
185
- )));
186
- return;
187
- }
188
- for (const contribution of extensionValue) {
189
- if (validateTypeOrModifier(contribution, 'semanticTokenType', collector)) {
190
- tokenClassificationRegistry.registerTokenType(contribution.id, contribution.description, contribution.superType);
191
- }
192
- }
193
- }
194
- for (const extension of delta.removed) {
195
- const extensionValue = extension.value;
196
- for (const contribution of extensionValue) {
197
- tokenClassificationRegistry.deregisterTokenType(contribution.id);
198
- }
199
- }
200
- });
201
- tokenModifierExtPoint.setHandler((extensions, delta) => {
202
- for (const extension of delta.added) {
203
- const extensionValue = extension.value;
204
- const collector = extension.collector;
205
- if (!extensionValue || !Array.isArray(extensionValue)) {
206
- collector.error(( localizeWithPath(
207
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
208
- 'invalid.semanticTokenModifierConfiguration',
209
- "'configuration.semanticTokenModifier' must be an array"
210
- )));
211
- return;
212
- }
213
- for (const contribution of extensionValue) {
214
- if (validateTypeOrModifier(contribution, 'semanticTokenModifier', collector)) {
215
- tokenClassificationRegistry.registerTokenModifier(contribution.id, contribution.description);
216
- }
217
- }
218
- }
219
- for (const extension of delta.removed) {
220
- const extensionValue = extension.value;
221
- for (const contribution of extensionValue) {
222
- tokenClassificationRegistry.deregisterTokenModifier(contribution.id);
223
- }
224
- }
225
- });
226
- tokenStyleDefaultsExtPoint.setHandler((extensions, delta) => {
227
- for (const extension of delta.added) {
228
- const extensionValue = extension.value;
229
- const collector = extension.collector;
230
- if (!extensionValue || !Array.isArray(extensionValue)) {
231
- collector.error(( localizeWithPath(
232
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
233
- 'invalid.semanticTokenScopes.configuration',
234
- "'configuration.semanticTokenScopes' must be an array"
235
- )));
236
- return;
237
- }
238
- for (const contribution of extensionValue) {
239
- if (contribution.language && typeof contribution.language !== 'string') {
240
- collector.error(( localizeWithPath(
241
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
242
- 'invalid.semanticTokenScopes.language',
243
- "'configuration.semanticTokenScopes.language' must be a string"
244
- )));
245
- continue;
246
- }
247
- if (!contribution.scopes || typeof contribution.scopes !== 'object') {
248
- collector.error(( localizeWithPath(
249
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
250
- 'invalid.semanticTokenScopes.scopes',
251
- "'configuration.semanticTokenScopes.scopes' must be defined as an object"
252
- )));
253
- continue;
254
- }
255
- for (const selectorString in contribution.scopes) {
256
- const tmScopes = contribution.scopes[selectorString];
257
- if (!Array.isArray(tmScopes) || ( tmScopes.some(l => typeof l !== 'string'))) {
258
- collector.error(( localizeWithPath(
259
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
260
- 'invalid.semanticTokenScopes.scopes.value',
261
- "'configuration.semanticTokenScopes.scopes' values must be an array of strings"
262
- )));
263
- continue;
264
- }
265
- try {
266
- const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
267
- tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( tmScopes.map(s => s.split(' '))) });
268
- }
269
- catch (e) {
270
- collector.error(( localizeWithPath(
271
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
272
- 'invalid.semanticTokenScopes.scopes.selector',
273
- "configuration.semanticTokenScopes.scopes': Problems parsing selector {0}.",
274
- selectorString
275
- )));
276
- }
277
- }
278
- }
279
- }
280
- for (const extension of delta.removed) {
281
- const extensionValue = extension.value;
282
- for (const contribution of extensionValue) {
283
- for (const selectorString in contribution.scopes) {
284
- const tmScopes = contribution.scopes[selectorString];
285
- try {
286
- const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
287
- tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( tmScopes.map(s => s.split(' '))) });
288
- }
289
- catch (e) {
290
- }
291
- }
292
- }
293
- }
294
- });
295
- }
296
- }
297
-
298
- export { TokenClassificationExtensionPoints };