@codingame/monaco-vscode-textmate-service-override 4.5.1 → 4.5.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": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "vscode": "npm:@codingame/monaco-vscode-api@4.5.1",
32
+ "vscode": "npm:@codingame/monaco-vscode-api@4.5.2",
33
33
  "vscode-oniguruma": "1.7.0",
34
34
  "vscode-textmate": "9.0.0",
35
- "@codingame/monaco-vscode-files-service-override": "4.5.1"
35
+ "@codingame/monaco-vscode-files-service-override": "4.5.2"
36
36
  }
37
37
  }
@@ -20,6 +20,7 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
20
20
  import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
21
21
 
22
22
  var InspectEditorTokensController_1;
23
+ const _moduleId = "vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens";
23
24
  const $ = $$1;
24
25
  let InspectEditorTokensController = class InspectEditorTokensController extends Disposable {
25
26
  static { InspectEditorTokensController_1 = this; }
@@ -55,7 +56,7 @@ let InspectEditorTokensController = class InspectEditorTokensController extends
55
56
  if (this._editor.getModel().uri.scheme === Schemas.vscodeNotebookCell) {
56
57
  return;
57
58
  }
58
- this._widget = ( new InspectEditorTokensWidget(
59
+ this._widget = ( (new InspectEditorTokensWidget(
59
60
  this._editor,
60
61
  this._textMateService,
61
62
  this._languageService,
@@ -63,7 +64,7 @@ let InspectEditorTokensController = class InspectEditorTokensController extends
63
64
  this._notificationService,
64
65
  this._configurationService,
65
66
  this._languageFeaturesService
66
- ));
67
+ )));
67
68
  }
68
69
  stop() {
69
70
  if (this._widget) {
@@ -80,23 +81,19 @@ let InspectEditorTokensController = class InspectEditorTokensController extends
80
81
  }
81
82
  }
82
83
  };
83
- InspectEditorTokensController = InspectEditorTokensController_1 = ( __decorate([
84
- ( __param(1, ITextMateTokenizationService)),
85
- ( __param(2, ILanguageService)),
86
- ( __param(3, IWorkbenchThemeService)),
87
- ( __param(4, INotificationService)),
88
- ( __param(5, IConfigurationService)),
89
- ( __param(6, ILanguageFeaturesService))
90
- ], InspectEditorTokensController));
84
+ InspectEditorTokensController = InspectEditorTokensController_1 = ( (__decorate([
85
+ ( (__param(1, ITextMateTokenizationService))),
86
+ ( (__param(2, ILanguageService))),
87
+ ( (__param(3, IWorkbenchThemeService))),
88
+ ( (__param(4, INotificationService))),
89
+ ( (__param(5, IConfigurationService))),
90
+ ( (__param(6, ILanguageFeaturesService)))
91
+ ], InspectEditorTokensController)));
91
92
  class InspectEditorTokens extends EditorAction {
92
93
  constructor() {
93
94
  super({
94
95
  id: 'editor.action.inspectTMScopes',
95
- label: ( localizeWithPath(
96
- 'vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens',
97
- 'inspectEditorTokens',
98
- "Developer: Inspect Editor Tokens and Scopes"
99
- )),
96
+ label: ( localizeWithPath(_moduleId, 0, "Developer: Inspect Editor Tokens and Scopes")),
100
97
  alias: 'Developer: Inspect Editor Tokens and Scopes',
101
98
  precondition: undefined
102
99
  });
@@ -142,7 +139,7 @@ class InspectEditorTokensWidget extends Disposable {
142
139
  this._model = this._editor.getModel();
143
140
  this._domNode = document.createElement('div');
144
141
  this._domNode.className = 'token-inspect-widget';
145
- this._currentRequestCancellationTokenSource = ( new CancellationTokenSource());
142
+ this._currentRequestCancellationTokenSource = ( (new CancellationTokenSource()));
146
143
  this._beginCompute(this._editor.getPosition());
147
144
  this._register(this._editor.onDidChangeCursorPosition((e) => this._beginCompute(this._editor.getPosition())));
148
145
  this._register(themeService.onDidColorThemeChange(_ => this._beginCompute(this._editor.getPosition())));
@@ -162,11 +159,7 @@ class InspectEditorTokensWidget extends Disposable {
162
159
  const grammar = this._textMateService.createTokenizer(this._model.getLanguageId());
163
160
  const semanticTokens = this._computeSemanticTokens(position);
164
161
  clearNode(this._domNode);
165
- this._domNode.appendChild(document.createTextNode(( localizeWithPath(
166
- 'vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens',
167
- 'inspectTMScopesWidget.loading',
168
- "Loading..."
169
- ))));
162
+ this._domNode.appendChild(document.createTextNode(( localizeWithPath(_moduleId, 1, "Loading..."))));
170
163
  Promise.all([grammar, semanticTokens]).then(([grammar, semanticTokens]) => {
171
164
  if (this._isDisposed) {
172
165
  return;
@@ -213,12 +206,12 @@ class InspectEditorTokensWidget extends Disposable {
213
206
  if (semanticTokenInfo.metadata) {
214
207
  const properties = ['foreground', 'bold', 'italic', 'underline', 'strikethrough'];
215
208
  const propertiesByDefValue = {};
216
- const allDefValues = ( new Array());
209
+ const allDefValues = ( (new Array()));
217
210
  for (const property of properties) {
218
211
  if (semanticTokenInfo.metadata[property] !== undefined) {
219
212
  const definition = semanticTokenInfo.definitions[property];
220
213
  const defValue = this._renderTokenStyleDefinition(definition, property);
221
- const defValueStr = ( defValue.map(el => el instanceof HTMLElement ? el.outerHTML : el)).join();
214
+ const defValueStr = ( (defValue.map(el => el instanceof HTMLElement ? el.outerHTML : el))).join();
222
215
  let properties = propertiesByDefValue[defValueStr];
223
216
  if (!properties) {
224
217
  propertiesByDefValue[defValueStr] = properties = [];
@@ -240,7 +233,7 @@ class InspectEditorTokensWidget extends Disposable {
240
233
  if (tmTokenText && tmTokenText !== tokenText) {
241
234
  append(tbody, $('tr', undefined, $('td.tiw-metadata-key', undefined, 'textmate token'), $('td.tiw-metadata-value', undefined, `${tmTokenText} (${tmTokenText.length})`)));
242
235
  }
243
- const scopes = ( new Array());
236
+ const scopes = ( (new Array()));
244
237
  for (let i = textMateTokenInfo.token.scopes.length - 1; i >= 0; i--) {
245
238
  scopes.push(textMateTokenInfo.token.scopes[i]);
246
239
  if (i > 0) {
@@ -265,7 +258,7 @@ class InspectEditorTokensWidget extends Disposable {
265
258
  }
266
259
  }
267
260
  _formatMetadata(semantic, tm) {
268
- const elements = ( new Array());
261
+ const elements = ( (new Array()));
269
262
  function render(property) {
270
263
  const value = semantic?.[property] || tm?.[property];
271
264
  if (value !== undefined) {
@@ -277,7 +270,7 @@ class InspectEditorTokensWidget extends Disposable {
277
270
  const foreground = render('foreground');
278
271
  const background = render('background');
279
272
  if (foreground && background) {
280
- const backgroundColor = ( Color.fromHex(background)), foregroundColor = ( Color.fromHex(foreground));
273
+ const backgroundColor = ( (Color.fromHex(background))), foregroundColor = ( (Color.fromHex(foreground)));
281
274
  if (backgroundColor.isOpaque()) {
282
275
  elements.push($('tr', undefined, $('td.tiw-metadata-key', undefined, 'contrast ratio'), $('td.tiw-metadata-value', undefined, backgroundColor.getContrastRatio(foregroundColor.makeOpaque(backgroundColor)).toFixed(2))));
283
276
  }
@@ -285,7 +278,7 @@ class InspectEditorTokensWidget extends Disposable {
285
278
  elements.push($('tr', undefined, $('td.tiw-metadata-key', undefined, 'Contrast ratio cannot be precise for background colors that use transparency'), $('td.tiw-metadata-value')));
286
279
  }
287
280
  }
288
- const fontStyleLabels = ( new Array());
281
+ const fontStyleLabels = ( (new Array()));
289
282
  function addStyle(key) {
290
283
  let label;
291
284
  if (semantic && semantic[key]) {
@@ -389,7 +382,7 @@ class InspectEditorTokensWidget extends Disposable {
389
382
  if (rangeTokenProviders.length) {
390
383
  const provider = rangeTokenProviders[0];
391
384
  const lineNumber = position.lineNumber;
392
- const range = ( new Range(lineNumber, 1, lineNumber, this._model.getLineMaxColumn(lineNumber)));
385
+ const range = ( (new Range(lineNumber, 1, lineNumber, this._model.getLineMaxColumn(lineNumber))));
393
386
  const tokens = await Promise.resolve(provider.provideDocumentRangeSemanticTokens(this._model, range, this._currentRequestCancellationTokenSource.token));
394
387
  if (this.isSemanticTokens(tokens)) {
395
388
  return { tokens, legend: provider.getLegend() };
@@ -420,7 +413,7 @@ class InspectEditorTokensWidget extends Disposable {
420
413
  if (modifierSet > 0) {
421
414
  modifiers.push('not in legend (ignored)');
422
415
  }
423
- const range = ( new Range(line + 1, character + 1, line + 1, character + 1 + len));
416
+ const range = ( (new Range(line + 1, character + 1, line + 1, character + 1 + len)));
424
417
  const definitions = {};
425
418
  const colorMap = this._themeService.getColorTheme().tokenColorMap;
426
419
  const theme = this._themeService.getColorTheme();
@@ -446,7 +439,7 @@ class InspectEditorTokensWidget extends Disposable {
446
439
  return null;
447
440
  }
448
441
  _renderTokenStyleDefinition(definition, property) {
449
- const elements = ( new Array());
442
+ const elements = ( (new Array()));
450
443
  if (definition === undefined) {
451
444
  return elements;
452
445
  }
@@ -34,6 +34,7 @@ import * as vscodeTextmate from 'vscode-textmate';
34
34
  import * as vscodeOniguruma from 'vscode-oniguruma';
35
35
 
36
36
  var TextMateTokenizationFeature_1;
37
+ const _moduleId = "vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl";
37
38
  let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disposable {
38
39
  static { TextMateTokenizationFeature_1 = this; }
39
40
  static { this.reportTokenizationTimeCounter = { sync: 0, async: 0 }; }
@@ -55,7 +56,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
55
56
  this._debugModePrintFunc = () => { };
56
57
  this._grammarDefinitions = null;
57
58
  this._grammarFactory = null;
58
- this._tokenizersRegistrations = ( new DisposableStore());
59
+ this._tokenizersRegistrations = ( (new DisposableStore()));
59
60
  this._currentTheme = null;
60
61
  this._currentTokenColorMap = null;
61
62
  this._threadedBackgroundTokenizerFactory = this._instantiationService.createInstance(ThreadedBackgroundTokenizerFactory, (timeMs, languageId, sourceExtensionId, lineLength, isRandomSample) => this._reportTokenizationTime(timeMs, languageId, sourceExtensionId, lineLength, true, isRandomSample), () => this.getAsyncTokenizationEnabled());
@@ -92,7 +93,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
92
93
  if (validatedGrammar) {
93
94
  this._grammarDefinitions.push(validatedGrammar);
94
95
  if (validatedGrammar.language) {
95
- const lazyTokenizationSupport = ( new LazyTokenizationSupport(() => this._createTokenizationSupport(validatedGrammar.language)));
96
+ const lazyTokenizationSupport = ( (new LazyTokenizationSupport(() => this._createTokenizationSupport(validatedGrammar.language))));
96
97
  this._tokenizersRegistrations.add(lazyTokenizationSupport);
97
98
  this._tokenizersRegistrations.add(TokenizationRegistry.registerFactory(validatedGrammar.language, lazyTokenizationSupport));
98
99
  }
@@ -111,7 +112,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
111
112
  const grammarLocation = joinPath(extension.description.extensionLocation, grammar.path);
112
113
  const embeddedLanguages = Object.create(null);
113
114
  if (grammar.embeddedLanguages) {
114
- const scopes = ( Object.keys(grammar.embeddedLanguages));
115
+ const scopes = ( (Object.keys(grammar.embeddedLanguages)));
115
116
  for (let i = 0, len = scopes.length; i < len; i++) {
116
117
  const scope = scopes[i];
117
118
  const language = grammar.embeddedLanguages[scope];
@@ -125,7 +126,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
125
126
  }
126
127
  const tokenTypes = Object.create(null);
127
128
  if (grammar.tokenTypes) {
128
- const scopes = ( Object.keys(grammar.tokenTypes));
129
+ const scopes = ( (Object.keys(grammar.tokenTypes)));
129
130
  for (const scope of scopes) {
130
131
  const tokenType = grammar.tokenTypes[scope];
131
132
  switch (tokenType) {
@@ -165,11 +166,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
165
166
  }
166
167
  startDebugMode(printFn, onStop) {
167
168
  if (this._debugMode) {
168
- this._notificationService.error(( localizeWithPath(
169
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
170
- 'alreadyDebugging',
171
- "Already Logging."
172
- )));
169
+ this._notificationService.error(( localizeWithPath(_moduleId, 0, "Already Logging.")));
173
170
  return;
174
171
  }
175
172
  this._debugModePrintFunc = printFn;
@@ -177,29 +174,23 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
177
174
  if (this._debugMode) {
178
175
  this._progressService.withProgress({
179
176
  location: 15 ,
180
- buttons: [( localizeWithPath(
181
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
182
- 'stop',
183
- "Stop"
184
- ))]
177
+ buttons: [( localizeWithPath(_moduleId, 1, "Stop"))]
185
178
  }, (progress) => {
186
179
  progress.report({
187
180
  message: ( localizeWithPath(
188
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
189
- 'progress1',
181
+ _moduleId,
182
+ 2,
190
183
  "Preparing to log TM Grammar parsing. Press Stop when finished."
191
184
  ))
192
185
  });
193
186
  return this._getVSCodeOniguruma().then((vscodeOniguruma) => {
194
187
  vscodeOniguruma.setDefaultDebugCall(true);
195
188
  progress.report({
196
- message: ( localizeWithPath(
197
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
198
- 'progress2',
199
- "Now logging TM Grammar parsing. Press Stop when finished."
200
- ))
189
+ message: ( localizeWithPath(_moduleId, 3, "Now logging TM Grammar parsing. Press Stop when finished."))
201
190
  });
202
- return ( new Promise((resolve, reject) => { }));
191
+ return (
192
+ (new Promise((resolve, reject) => { }))
193
+ );
203
194
  });
204
195
  }, (choice) => {
205
196
  this._getVSCodeOniguruma().then((vscodeOniguruma) => {
@@ -226,11 +217,11 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
226
217
  if (this._grammarFactory) {
227
218
  return this._grammarFactory;
228
219
  }
229
- this._grammarFactory = ( new TMGrammarFactory({
220
+ this._grammarFactory = ( (new TMGrammarFactory({
230
221
  logTrace: (msg) => this._logService.trace(msg),
231
222
  logError: (msg, err) => this._logService.error(msg, err),
232
223
  readFile: (resource) => this._extensionResourceLoaderService.readExtensionResource(resource)
233
- }, this._grammarDefinitions || [], vscodeTextmate, onigLib));
224
+ }, this._grammarDefinitions || [], vscodeTextmate, onigLib)));
234
225
  this._updateTheme(this._themeService.getColorTheme(), true);
235
226
  return this._grammarFactory;
236
227
  }
@@ -243,7 +234,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
243
234
  }
244
235
  try {
245
236
  const grammarFactory = await this._getOrCreateGrammarFactory();
246
- if (!( grammarFactory.has(languageId))) {
237
+ if (!( (grammarFactory.has(languageId)))) {
247
238
  return null;
248
239
  }
249
240
  const encodedLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
@@ -252,7 +243,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
252
243
  return null;
253
244
  }
254
245
  const maxTokenizationLineLength = observableConfigValue('editor.maxTokenizationLineLength', languageId, -1, this._configurationService);
255
- const tokenization = ( new TextMateTokenizationSupport(
246
+ const tokenization = ( (new TextMateTokenizationSupport(
256
247
  r.grammar,
257
248
  r.initialState,
258
249
  r.containsEmbeddedLanguages,
@@ -262,7 +253,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
262
253
  this._reportTokenizationTime(timeMs, languageId, r.sourceExtensionId, lineLength, false, isRandomSample);
263
254
  },
264
255
  true
265
- ));
256
+ )));
266
257
  tokenization.onDidEncounterLanguage((encodedLanguageId) => {
267
258
  if (!this._encounteredLanguages[encodedLanguageId]) {
268
259
  const languageId = this._languageService.languageIdCodec.decodeLanguageId(encodedLanguageId);
@@ -270,7 +261,9 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
270
261
  this._languageService.requestBasicLanguageFeatures(languageId);
271
262
  }
272
263
  });
273
- return ( new TokenizationSupportWithLineLimit(encodedLanguageId, tokenization, maxTokenizationLineLength));
264
+ return (
265
+ (new TokenizationSupportWithLineLimit(encodedLanguageId, tokenization, maxTokenizationLineLength))
266
+ );
274
267
  }
275
268
  catch (err) {
276
269
  if (err.message && err.message === missingTMGrammarErrorMessage) {
@@ -301,7 +294,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
301
294
  return null;
302
295
  }
303
296
  const grammarFactory = await this._getOrCreateGrammarFactory();
304
- if (!( grammarFactory.has(languageId))) {
297
+ if (!( (grammarFactory.has(languageId)))) {
305
298
  return null;
306
299
  }
307
300
  const encodedLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
@@ -325,13 +318,13 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
325
318
  }
326
319
  async _loadVSCodeOnigurumaWASM() {
327
320
  if (isWeb) {
328
- const response = await fetch(( ( FileAccess.asBrowserUri('vscode-oniguruma/../onig.wasm')).toString(true)));
321
+ const response = await fetch(( (( (FileAccess.asBrowserUri('vscode-oniguruma/../onig.wasm'))).toString(true))));
329
322
  return await response.arrayBuffer();
330
323
  }
331
324
  else {
332
325
  const response = await fetch(this._environmentService.isBuilt
333
- ? ( ( FileAccess.asBrowserUri(`${nodeModulesAsarUnpackedPath}/vscode-oniguruma/release/onig.wasm`)).toString(true))
334
- : ( ( FileAccess.asBrowserUri(`${nodeModulesPath}/vscode-oniguruma/release/onig.wasm`)).toString(true)));
326
+ ? ( (( (FileAccess.asBrowserUri(`${nodeModulesAsarUnpackedPath}/vscode-oniguruma/release/onig.wasm`))).toString(true)))
327
+ : ( (( (FileAccess.asBrowserUri(`${nodeModulesPath}/vscode-oniguruma/release/onig.wasm`))).toString(true))));
335
328
  return response;
336
329
  }
337
330
  }
@@ -357,22 +350,22 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
357
350
  });
358
351
  }
359
352
  };
360
- TextMateTokenizationFeature = TextMateTokenizationFeature_1 = ( __decorate([
361
- ( __param(0, ILanguageService)),
362
- ( __param(1, IWorkbenchThemeService)),
363
- ( __param(2, IExtensionResourceLoaderService)),
364
- ( __param(3, INotificationService)),
365
- ( __param(4, ILogService)),
366
- ( __param(5, IConfigurationService)),
367
- ( __param(6, IProgressService)),
368
- ( __param(7, IWorkbenchEnvironmentService)),
369
- ( __param(8, IInstantiationService)),
370
- ( __param(9, ITelemetryService))
371
- ], TextMateTokenizationFeature));
353
+ TextMateTokenizationFeature = TextMateTokenizationFeature_1 = ( (__decorate([
354
+ ( (__param(0, ILanguageService))),
355
+ ( (__param(1, IWorkbenchThemeService))),
356
+ ( (__param(2, IExtensionResourceLoaderService))),
357
+ ( (__param(3, INotificationService))),
358
+ ( (__param(4, ILogService))),
359
+ ( (__param(5, IConfigurationService))),
360
+ ( (__param(6, IProgressService))),
361
+ ( (__param(7, IWorkbenchEnvironmentService))),
362
+ ( (__param(8, IInstantiationService))),
363
+ ( (__param(9, ITelemetryService)))
364
+ ], TextMateTokenizationFeature)));
372
365
  function toColorMap(colorMap) {
373
366
  const result = [null];
374
367
  for (let i = 1, len = colorMap.length; i < len; i++) {
375
- result[i] = ( Color.fromHex(colorMap[i]));
368
+ result[i] = ( (Color.fromHex(colorMap[i])));
376
369
  }
377
370
  return result;
378
371
  }
@@ -402,8 +395,8 @@ function equalsTokenRules(a, b) {
402
395
  function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _languageService) {
403
396
  if (syntax.language && ((typeof syntax.language !== 'string') || !_languageService.isRegisteredLanguageId(syntax.language))) {
404
397
  collector.error(( localizeWithPath(
405
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
406
- 'invalid.language',
398
+ _moduleId,
399
+ 4,
407
400
  "Unknown language in `contributes.{0}.language`. Provided value: {1}",
408
401
  grammarsExtPoint.name,
409
402
  String(syntax.language)
@@ -412,8 +405,8 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
412
405
  }
413
406
  if (!syntax.scopeName || (typeof syntax.scopeName !== 'string')) {
414
407
  collector.error(( localizeWithPath(
415
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
416
- 'invalid.scopeName',
408
+ _moduleId,
409
+ 5,
417
410
  "Expected string in `contributes.{0}.scopeName`. Provided value: {1}",
418
411
  grammarsExtPoint.name,
419
412
  String(syntax.scopeName)
@@ -422,18 +415,18 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
422
415
  }
423
416
  if (!syntax.path || (typeof syntax.path !== 'string')) {
424
417
  collector.error(( localizeWithPath(
425
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
426
- 'invalid.path.0',
418
+ _moduleId,
419
+ 6,
427
420
  "Expected string in `contributes.{0}.path`. Provided value: {1}",
428
421
  grammarsExtPoint.name,
429
422
  String(syntax.path)
430
423
  )));
431
424
  return false;
432
425
  }
433
- if (syntax.injectTo && (!Array.isArray(syntax.injectTo) || ( syntax.injectTo.some(scope => typeof scope !== 'string')))) {
426
+ if (syntax.injectTo && (!Array.isArray(syntax.injectTo) || ( (syntax.injectTo.some(scope => typeof scope !== 'string'))))) {
434
427
  collector.error(( localizeWithPath(
435
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
436
- 'invalid.injectTo',
428
+ _moduleId,
429
+ 7,
437
430
  "Invalid value in `contributes.{0}.injectTo`. Must be an array of language scope names. Provided value: {1}",
438
431
  grammarsExtPoint.name,
439
432
  JSON.stringify(syntax.injectTo)
@@ -442,8 +435,8 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
442
435
  }
443
436
  if (syntax.embeddedLanguages && !isObject(syntax.embeddedLanguages)) {
444
437
  collector.error(( localizeWithPath(
445
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
446
- 'invalid.embeddedLanguages',
438
+ _moduleId,
439
+ 8,
447
440
  "Invalid value in `contributes.{0}.embeddedLanguages`. Must be an object map from scope name to language. Provided value: {1}",
448
441
  grammarsExtPoint.name,
449
442
  JSON.stringify(syntax.embeddedLanguages)
@@ -452,8 +445,8 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
452
445
  }
453
446
  if (syntax.tokenTypes && !isObject(syntax.tokenTypes)) {
454
447
  collector.error(( localizeWithPath(
455
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
456
- 'invalid.tokenTypes',
448
+ _moduleId,
449
+ 9,
457
450
  "Invalid value in `contributes.{0}.tokenTypes`. Must be an object map from scope name to token type. Provided value: {1}",
458
451
  grammarsExtPoint.name,
459
452
  JSON.stringify(syntax.tokenTypes)
@@ -463,8 +456,8 @@ function validateGrammarExtensionPoint(extensionLocation, syntax, collector, _la
463
456
  const grammarLocation = joinPath(extensionLocation, syntax.path);
464
457
  if (!isEqualOrParent(grammarLocation, extensionLocation)) {
465
458
  collector.warn(( localizeWithPath(
466
- 'vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl',
467
- 'invalid.path.1',
459
+ _moduleId,
460
+ 10,
468
461
  "Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.",
469
462
  grammarsExtPoint.name,
470
463
  grammarLocation.path,
@@ -25,7 +25,7 @@ class TextMateTokenizationSupport extends Disposable {
25
25
  return this._initialState;
26
26
  }
27
27
  tokenize(line, hasEOL, state) {
28
- throw new Error('Not supported!');
28
+ throw ( new Error('Not supported!'));
29
29
  }
30
30
  createBackgroundTokenizer(textModel, store) {
31
31
  if (this._createBackgroundTokenizer) {
@@ -20,7 +20,7 @@ class TokenizationSupportWithLineLimit extends Disposable {
20
20
  return this._actual.getInitialState();
21
21
  }
22
22
  tokenize(line, hasEOL, state) {
23
- throw new Error('Not supported!');
23
+ throw ( new Error('Not supported!'));
24
24
  }
25
25
  tokenizeEncoded(line, hasEOL, state) {
26
26
  if (line.length >= this._maxTokenizationLineLength.get()) {
@@ -76,11 +76,11 @@ class TMGrammarFactory extends Disposable {
76
76
  async createGrammar(languageId, encodedLanguageId) {
77
77
  const scopeName = this._languageToScope.get(languageId);
78
78
  if (typeof scopeName !== 'string') {
79
- throw new Error(missingTMGrammarErrorMessage);
79
+ throw ( new Error(missingTMGrammarErrorMessage));
80
80
  }
81
81
  const grammarDefinition = this._scopeRegistry.getGrammarDefinition(scopeName);
82
82
  if (!grammarDefinition) {
83
- throw new Error(missingTMGrammarErrorMessage);
83
+ throw ( new Error(missingTMGrammarErrorMessage));
84
84
  }
85
85
  const embeddedLanguages = grammarDefinition.embeddedLanguages;
86
86
  if (this._injectedEmbeddedLanguages[scopeName]) {
@@ -103,7 +103,7 @@ class TMGrammarFactory extends Disposable {
103
103
  }
104
104
  catch (err) {
105
105
  if (err.message && err.message.startsWith('No grammar provided for')) {
106
- throw new Error(missingTMGrammarErrorMessage);
106
+ throw ( new Error(missingTMGrammarErrorMessage));
107
107
  }
108
108
  throw err;
109
109
  }
@@ -5,54 +5,39 @@ import { getTokenClassificationRegistry, typeAndModifierIdPattern } from 'vscode
5
5
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
6
  import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
7
7
 
8
+ const _moduleId = "vs/workbench/services/themes/common/tokenClassificationExtensionPoint";
8
9
  const tokenClassificationRegistry = getTokenClassificationRegistry();
9
10
  const tokenTypeExtPoint = ExtensionsRegistry.registerExtensionPoint({
10
11
  extensionPoint: 'semanticTokenTypes',
11
12
  jsonSchema: {
12
- description: ( localizeWithPath(
13
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
14
- 'contributes.semanticTokenTypes',
15
- 'Contributes semantic token types.'
16
- )),
13
+ description: ( localizeWithPath(_moduleId, 0, 'Contributes semantic token types.')),
17
14
  type: 'array',
18
15
  items: {
19
16
  type: 'object',
20
17
  properties: {
21
18
  id: {
22
19
  type: 'string',
23
- description: ( localizeWithPath(
24
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
25
- 'contributes.semanticTokenTypes.id',
26
- 'The identifier of the semantic token type'
27
- )),
20
+ description: ( localizeWithPath(_moduleId, 1, 'The identifier of the semantic token type')),
28
21
  pattern: typeAndModifierIdPattern,
29
22
  patternErrorMessage: ( localizeWithPath(
30
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
31
- 'contributes.semanticTokenTypes.id.format',
23
+ _moduleId,
24
+ 2,
32
25
  'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
33
26
  )),
34
27
  },
35
28
  superType: {
36
29
  type: 'string',
37
- description: ( localizeWithPath(
38
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
39
- 'contributes.semanticTokenTypes.superType',
40
- 'The super type of the semantic token type'
41
- )),
30
+ description: ( localizeWithPath(_moduleId, 3, 'The super type of the semantic token type')),
42
31
  pattern: typeAndModifierIdPattern,
43
32
  patternErrorMessage: ( localizeWithPath(
44
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
45
- 'contributes.semanticTokenTypes.superType.format',
33
+ _moduleId,
34
+ 4,
46
35
  'Super types should be in the form letterOrDigit[_-letterOrDigit]*'
47
36
  )),
48
37
  },
49
38
  description: {
50
39
  type: 'string',
51
- description: ( localizeWithPath(
52
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
53
- 'contributes.color.description',
54
- 'The description of the semantic token type'
55
- )),
40
+ description: ( localizeWithPath(_moduleId, 5, 'The description of the semantic token type')),
56
41
  }
57
42
  }
58
43
  }
@@ -61,36 +46,24 @@ const tokenTypeExtPoint = ExtensionsRegistry.registerExtensionPoint({
61
46
  const tokenModifierExtPoint = ExtensionsRegistry.registerExtensionPoint({
62
47
  extensionPoint: 'semanticTokenModifiers',
63
48
  jsonSchema: {
64
- description: ( localizeWithPath(
65
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
66
- 'contributes.semanticTokenModifiers',
67
- 'Contributes semantic token modifiers.'
68
- )),
49
+ description: ( localizeWithPath(_moduleId, 6, 'Contributes semantic token modifiers.')),
69
50
  type: 'array',
70
51
  items: {
71
52
  type: 'object',
72
53
  properties: {
73
54
  id: {
74
55
  type: 'string',
75
- description: ( localizeWithPath(
76
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
77
- 'contributes.semanticTokenModifiers.id',
78
- 'The identifier of the semantic token modifier'
79
- )),
56
+ description: ( localizeWithPath(_moduleId, 7, 'The identifier of the semantic token modifier')),
80
57
  pattern: typeAndModifierIdPattern,
81
58
  patternErrorMessage: ( localizeWithPath(
82
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
83
- 'contributes.semanticTokenModifiers.id.format',
59
+ _moduleId,
60
+ 8,
84
61
  'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'
85
62
  ))
86
63
  },
87
64
  description: {
88
65
  type: 'string',
89
- description: ( localizeWithPath(
90
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
91
- 'contributes.semanticTokenModifiers.description',
92
- 'The description of the semantic token modifier'
93
- ))
66
+ description: ( localizeWithPath(_moduleId, 9, 'The description of the semantic token modifier'))
94
67
  }
95
68
  }
96
69
  }
@@ -99,27 +72,19 @@ const tokenModifierExtPoint = ExtensionsRegistry.registerExtensionPoint({
99
72
  const tokenStyleDefaultsExtPoint = ExtensionsRegistry.registerExtensionPoint({
100
73
  extensionPoint: 'semanticTokenScopes',
101
74
  jsonSchema: {
102
- description: ( localizeWithPath(
103
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
104
- 'contributes.semanticTokenScopes',
105
- 'Contributes semantic token scope maps.'
106
- )),
75
+ description: ( localizeWithPath(_moduleId, 10, 'Contributes semantic token scope maps.')),
107
76
  type: 'array',
108
77
  items: {
109
78
  type: 'object',
110
79
  properties: {
111
80
  language: {
112
- description: ( localizeWithPath(
113
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
114
- 'contributes.semanticTokenScopes.languages',
115
- 'Lists the languge for which the defaults are.'
116
- )),
81
+ description: ( localizeWithPath(_moduleId, 11, 'Lists the languge for which the defaults are.')),
117
82
  type: 'string'
118
83
  },
119
84
  scopes: {
120
85
  description: ( localizeWithPath(
121
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
122
- 'contributes.semanticTokenScopes.scopes',
86
+ _moduleId,
87
+ 12,
123
88
  'Maps a semantic token (described by semantic token selector) to one or more textMate scopes used to represent that token.'
124
89
  )),
125
90
  type: 'object',
@@ -139,8 +104,8 @@ class TokenClassificationExtensionPoints {
139
104
  function validateTypeOrModifier(contribution, extensionPoint, collector) {
140
105
  if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
141
106
  collector.error(( localizeWithPath(
142
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
143
- 'invalid.id',
107
+ _moduleId,
108
+ 13,
144
109
  "'configuration.{0}.id' must be defined and can not be empty",
145
110
  extensionPoint
146
111
  )));
@@ -148,8 +113,8 @@ class TokenClassificationExtensionPoints {
148
113
  }
149
114
  if (!contribution.id.match(typeAndModifierIdPattern)) {
150
115
  collector.error(( localizeWithPath(
151
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
152
- 'invalid.id.format',
116
+ _moduleId,
117
+ 14,
153
118
  "'configuration.{0}.id' must follow the pattern letterOrDigit[-_letterOrDigit]*",
154
119
  extensionPoint
155
120
  )));
@@ -158,8 +123,8 @@ class TokenClassificationExtensionPoints {
158
123
  const superType = contribution.superType;
159
124
  if (superType && !superType.match(typeAndModifierIdPattern)) {
160
125
  collector.error(( localizeWithPath(
161
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
162
- 'invalid.superType.format',
126
+ _moduleId,
127
+ 15,
163
128
  "'configuration.{0}.superType' must follow the pattern letterOrDigit[-_letterOrDigit]*",
164
129
  extensionPoint
165
130
  )));
@@ -167,8 +132,8 @@ class TokenClassificationExtensionPoints {
167
132
  }
168
133
  if (typeof contribution.description !== 'string' || contribution.id.length === 0) {
169
134
  collector.error(( localizeWithPath(
170
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
171
- 'invalid.description',
135
+ _moduleId,
136
+ 16,
172
137
  "'configuration.{0}.description' must be defined and can not be empty",
173
138
  extensionPoint
174
139
  )));
@@ -181,11 +146,7 @@ class TokenClassificationExtensionPoints {
181
146
  const extensionValue = extension.value;
182
147
  const collector = extension.collector;
183
148
  if (!extensionValue || !Array.isArray(extensionValue)) {
184
- collector.error(( localizeWithPath(
185
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
186
- 'invalid.semanticTokenTypeConfiguration',
187
- "'configuration.semanticTokenType' must be an array"
188
- )));
149
+ collector.error(( localizeWithPath(_moduleId, 17, "'configuration.semanticTokenType' must be an array")));
189
150
  return;
190
151
  }
191
152
  for (const contribution of extensionValue) {
@@ -206,11 +167,7 @@ class TokenClassificationExtensionPoints {
206
167
  const extensionValue = extension.value;
207
168
  const collector = extension.collector;
208
169
  if (!extensionValue || !Array.isArray(extensionValue)) {
209
- collector.error(( localizeWithPath(
210
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
211
- 'invalid.semanticTokenModifierConfiguration',
212
- "'configuration.semanticTokenModifier' must be an array"
213
- )));
170
+ collector.error(( localizeWithPath(_moduleId, 18, "'configuration.semanticTokenModifier' must be an array")));
214
171
  return;
215
172
  }
216
173
  for (const contribution of extensionValue) {
@@ -231,48 +188,44 @@ class TokenClassificationExtensionPoints {
231
188
  const extensionValue = extension.value;
232
189
  const collector = extension.collector;
233
190
  if (!extensionValue || !Array.isArray(extensionValue)) {
234
- collector.error(( localizeWithPath(
235
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
236
- 'invalid.semanticTokenScopes.configuration',
237
- "'configuration.semanticTokenScopes' must be an array"
238
- )));
191
+ collector.error(( localizeWithPath(_moduleId, 19, "'configuration.semanticTokenScopes' must be an array")));
239
192
  return;
240
193
  }
241
194
  for (const contribution of extensionValue) {
242
195
  if (contribution.language && typeof contribution.language !== 'string') {
243
196
  collector.error(( localizeWithPath(
244
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
245
- 'invalid.semanticTokenScopes.language',
197
+ _moduleId,
198
+ 20,
246
199
  "'configuration.semanticTokenScopes.language' must be a string"
247
200
  )));
248
201
  continue;
249
202
  }
250
203
  if (!contribution.scopes || typeof contribution.scopes !== 'object') {
251
204
  collector.error(( localizeWithPath(
252
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
253
- 'invalid.semanticTokenScopes.scopes',
205
+ _moduleId,
206
+ 21,
254
207
  "'configuration.semanticTokenScopes.scopes' must be defined as an object"
255
208
  )));
256
209
  continue;
257
210
  }
258
211
  for (const selectorString in contribution.scopes) {
259
212
  const tmScopes = contribution.scopes[selectorString];
260
- if (!Array.isArray(tmScopes) || ( tmScopes.some(l => typeof l !== 'string'))) {
213
+ if (!Array.isArray(tmScopes) || ( (tmScopes.some(l => typeof l !== 'string')))) {
261
214
  collector.error(( localizeWithPath(
262
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
263
- 'invalid.semanticTokenScopes.scopes.value',
215
+ _moduleId,
216
+ 22,
264
217
  "'configuration.semanticTokenScopes.scopes' values must be an array of strings"
265
218
  )));
266
219
  continue;
267
220
  }
268
221
  try {
269
222
  const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
270
- tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( tmScopes.map(s => s.split(' '))) });
223
+ tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( (tmScopes.map(s => s.split(' ')))) });
271
224
  }
272
225
  catch (e) {
273
226
  collector.error(( localizeWithPath(
274
- 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint',
275
- 'invalid.semanticTokenScopes.scopes.selector',
227
+ _moduleId,
228
+ 23,
276
229
  "configuration.semanticTokenScopes.scopes': Problems parsing selector {0}.",
277
230
  selectorString
278
231
  )));
@@ -287,7 +240,7 @@ class TokenClassificationExtensionPoints {
287
240
  const tmScopes = contribution.scopes[selectorString];
288
241
  try {
289
242
  const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language);
290
- tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( tmScopes.map(s => s.split(' '))) });
243
+ tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: ( (tmScopes.map(s => s.split(' ')))) });
291
244
  }
292
245
  catch (e) {
293
246
  }
@@ -304,9 +257,9 @@ let TokenClassificationExtensionPointWorkbenchContribution = class TokenClassifi
304
257
  this.instantiationService.createInstance(TokenClassificationExtensionPoints);
305
258
  }
306
259
  };
307
- TokenClassificationExtensionPointWorkbenchContribution = ( __decorate([
308
- ( __param(0, IInstantiationService))
309
- ], TokenClassificationExtensionPointWorkbenchContribution));
260
+ TokenClassificationExtensionPointWorkbenchContribution = ( (__decorate([
261
+ ( (__param(0, IInstantiationService)))
262
+ ], TokenClassificationExtensionPointWorkbenchContribution)));
310
263
  registerWorkbenchContribution2(TokenClassificationExtensionPointWorkbenchContribution.ID, TokenClassificationExtensionPointWorkbenchContribution, 1 );
311
264
 
312
265
  export { TokenClassificationExtensionPoints };