@codingame/monaco-vscode-textmate-service-override 5.3.0 → 6.0.1

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": "5.3.0",
3
+ "version": "6.0.1",
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@5.3.0",
32
+ "vscode": "npm:@codingame/monaco-vscode-api@6.0.1",
33
33
  "vscode-oniguruma": "1.7.0",
34
34
  "vscode-textmate": "9.0.0",
35
- "@codingame/monaco-vscode-files-service-override": "5.3.0"
35
+ "@codingame/monaco-vscode-files-service-override": "6.0.1"
36
36
  }
37
37
  }
@@ -1,12 +1,15 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import './inspectEditorTokens.css.js';
3
3
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
- import { $ as $$1, clearNode, reset, append } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { $ as $$1, clearNode, reset, append, isHTMLElement } from 'vscode/vscode/vs/base/browser/dom';
5
+ import { CharCode } from 'vscode/vscode/vs/base/common/charCode';
5
6
  import { Color } from 'vscode/vscode/vs/base/common/color';
7
+ import { KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
6
8
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
- import { EditorAction, registerEditorContribution, registerEditorAction } from 'vscode/vscode/vs/editor/browser/editorExtensions';
9
+ import { ContentWidgetPositionPreference } from 'vscode/vscode/vs/editor/browser/editorBrowser';
10
+ import { EditorAction, registerEditorContribution, EditorContributionInstantiation, registerEditorAction } from 'vscode/vscode/vs/editor/browser/editorExtensions';
8
11
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
9
- import { TokenMetadata } from 'vscode/vscode/vs/editor/common/encodedTokenAttributes';
12
+ import { StandardTokenType, TokenMetadata, FontStyle, ColorId } from 'vscode/vscode/vs/editor/common/encodedTokenAttributes';
10
13
  import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
11
14
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
12
15
  import { findMatchingThemeRule } from '../../../../services/textMate/common/TMHelper.js';
@@ -40,7 +43,7 @@ let InspectEditorTokensController = class InspectEditorTokensController extends
40
43
  this._widget = null;
41
44
  this._register(this._editor.onDidChangeModel((e) => this.stop()));
42
45
  this._register(this._editor.onDidChangeModelLanguage((e) => this.stop()));
43
- this._register(this._editor.onKeyUp((e) => e.keyCode === 9 && this.stop()));
46
+ this._register(this._editor.onKeyUp((e) => e.keyCode === KeyCode.Escape && this.stop()));
44
47
  }
45
48
  dispose() {
46
49
  this.stop();
@@ -111,10 +114,10 @@ function renderTokenText(tokenText) {
111
114
  for (let charIndex = 0, len = tokenText.length; charIndex < len; charIndex++) {
112
115
  const charCode = tokenText.charCodeAt(charIndex);
113
116
  switch (charCode) {
114
- case 9 :
117
+ case CharCode.Tab:
115
118
  result += '\u2192';
116
119
  break;
117
- case 32 :
120
+ case CharCode.Space:
118
121
  result += '\u00B7';
119
122
  break;
120
123
  default:
@@ -195,7 +198,7 @@ class InspectEditorTokensWidget extends Disposable {
195
198
  const tokenText = semTokenText || tmTokenText || '';
196
199
  reset(this._domNode, $('h2.tiw-token', undefined, tokenText, $('span.tiw-token-length', undefined, `${tokenText.length} ${tokenText.length === 1 ? 'char' : 'chars'}`)));
197
200
  append(this._domNode, $('hr.tiw-metadata-separator', { 'style': 'clear:both' }));
198
- append(this._domNode, $('table.tiw-metadata-table', undefined, $('tbody', undefined, $('tr', undefined, $('td.tiw-metadata-key', undefined, 'language'), $('td.tiw-metadata-value', undefined, tmMetadata?.languageId || '')), $('tr', undefined, $('td.tiw-metadata-key', undefined, 'standard token type'), $('td.tiw-metadata-value', undefined, this._tokenTypeToString(tmMetadata?.tokenType || 0 ))), ...this._formatMetadata(semMetadata, tmMetadata))));
201
+ append(this._domNode, $('table.tiw-metadata-table', undefined, $('tbody', undefined, $('tr', undefined, $('td.tiw-metadata-key', undefined, 'language'), $('td.tiw-metadata-value', undefined, tmMetadata?.languageId || '')), $('tr', undefined, $('td.tiw-metadata-key', undefined, 'standard token type'), $('td.tiw-metadata-value', undefined, this._tokenTypeToString(tmMetadata?.tokenType || StandardTokenType.Other))), ...this._formatMetadata(semMetadata, tmMetadata))));
199
202
  if (semanticTokenInfo) {
200
203
  append(this._domNode, $('hr.tiw-metadata-separator'));
201
204
  const table = append(this._domNode, $('table.tiw-metadata-table', undefined));
@@ -211,7 +214,7 @@ class InspectEditorTokensWidget extends Disposable {
211
214
  if (semanticTokenInfo.metadata[property] !== undefined) {
212
215
  const definition = semanticTokenInfo.definitions[property];
213
216
  const defValue = this._renderTokenStyleDefinition(definition, property);
214
- const defValueStr = ( (defValue.map(el => el instanceof HTMLElement ? el.outerHTML : el))).join();
217
+ const defValueStr = ( (defValue.map(el => isHTMLElement(el) ? el.outerHTML : el))).join();
215
218
  let properties = propertiesByDefValue[defValueStr];
216
219
  if (!properties) {
217
220
  propertiesByDefValue[defValueStr] = properties = [];
@@ -313,20 +316,20 @@ class InspectEditorTokensWidget extends Disposable {
313
316
  return {
314
317
  languageId: this._languageService.languageIdCodec.decodeLanguageId(languageId),
315
318
  tokenType: tokenType,
316
- bold: ((fontStyle & 2) ) ? true : undefined,
317
- italic: ((fontStyle & 1) ) ? true : undefined,
318
- underline: ((fontStyle & 4) ) ? true : undefined,
319
- strikethrough: ((fontStyle & 8) ) ? true : undefined,
319
+ bold: (fontStyle & FontStyle.Bold) ? true : undefined,
320
+ italic: (fontStyle & FontStyle.Italic) ? true : undefined,
321
+ underline: (fontStyle & FontStyle.Underline) ? true : undefined,
322
+ strikethrough: (fontStyle & FontStyle.Strikethrough) ? true : undefined,
320
323
  foreground: colorMap[foreground],
321
324
  background: colorMap[background]
322
325
  };
323
326
  }
324
327
  _tokenTypeToString(tokenType) {
325
328
  switch (tokenType) {
326
- case 0 : return 'Other';
327
- case 1 : return 'Comment';
328
- case 2 : return 'String';
329
- case 3 : return 'RegEx';
329
+ case StandardTokenType.Other: return 'Other';
330
+ case StandardTokenType.Comment: return 'Comment';
331
+ case StandardTokenType.String: return 'String';
332
+ case StandardTokenType.RegEx: return 'RegEx';
330
333
  default: return '??';
331
334
  }
332
335
  }
@@ -422,12 +425,12 @@ class InspectEditorTokensWidget extends Disposable {
422
425
  if (tokenStyle) {
423
426
  metadata = {
424
427
  languageId: undefined,
425
- tokenType: 0 ,
428
+ tokenType: StandardTokenType.Other,
426
429
  bold: tokenStyle?.bold,
427
430
  italic: tokenStyle?.italic,
428
431
  underline: tokenStyle?.underline,
429
432
  strikethrough: tokenStyle?.strikethrough,
430
- foreground: colorMap[tokenStyle?.foreground || 0 ],
433
+ foreground: colorMap[tokenStyle?.foreground || ColorId.None],
431
434
  background: undefined
432
435
  };
433
436
  }
@@ -489,9 +492,9 @@ class InspectEditorTokensWidget extends Disposable {
489
492
  getPosition() {
490
493
  return {
491
494
  position: this._editor.getPosition(),
492
- preference: [2 , 1 ]
495
+ preference: [ContentWidgetPositionPreference.BELOW, ContentWidgetPositionPreference.ABOVE]
493
496
  };
494
497
  }
495
498
  }
496
- registerEditorContribution(InspectEditorTokensController.ID, InspectEditorTokensController, 4 );
499
+ registerEditorContribution(InspectEditorTokensController.ID, InspectEditorTokensController, EditorContributionInstantiation.Lazy);
497
500
  registerEditorAction(InspectEditorTokens);
@@ -2,13 +2,14 @@ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
2
2
  import 'vscode/vscode/vs/base/common/arrays';
3
3
  import 'vscode/vscode/vs/base/common/observableInternal/derived';
4
4
  import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
5
- import { keepObserved, observableFromEvent } from 'vscode/vscode/vs/base/common/observableInternal/utils';
5
+ import { keepObserved } from 'vscode/vscode/vs/base/common/observableInternal/utils';
6
6
  import 'vscode/vscode/vs/base/common/cancellation';
7
7
  import { countEOL } from 'vscode/vscode/vs/editor/common/core/eolCounter';
8
8
  import { LineRange } from 'vscode/vscode/vs/editor/common/core/lineRange';
9
9
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
10
10
  import { TokenizationStateStore } from 'vscode/vscode/vs/editor/common/model/textModelTokens';
11
11
  import { ContiguousMultilineTokensBuilder } from 'vscode/vscode/vs/editor/common/tokens/contiguousMultilineTokensBuilder';
12
+ import { observableConfigValue } from 'vscode/vscode/vs/platform/observable/common/platformObservableUtils';
12
13
  import { MonotonousIndexTransformer, ArrayEdit, SingleArrayEdit } from '../arrayOperation.js';
13
14
  import { applyStateStackDiff, INITIAL } from 'vscode-textmate';
14
15
 
@@ -152,12 +153,5 @@ function fullLineArrayEditFromModelContentChange(c) {
152
153
  function changesToString(changes) {
153
154
  return ( changes.map(c => ( Range.lift(c.range).toString()) + ' => ' + c.text)).join(' & ');
154
155
  }
155
- function observableConfigValue(key, defaultValue, configurationService) {
156
- return observableFromEvent((handleChange) => configurationService.onDidChangeConfiguration(e => {
157
- if (e.affectsConfiguration(key)) {
158
- handleChange(e);
159
- }
160
- }), () => configurationService.getValue(key) ?? defaultValue);
161
- }
162
156
 
163
157
  export { TextMateWorkerTokenizerController };
@@ -12,6 +12,7 @@ import 'vscode/vscode/vs/base/common/cancellation';
12
12
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
13
13
  import { joinPath, isEqualOrParent } from 'vscode/vscode/vs/base/common/resources';
14
14
  import { isObject } from 'vscode/vscode/vs/base/common/types';
15
+ import { StandardTokenType } from 'vscode/vscode/vs/editor/common/encodedTokenAttributes';
15
16
  import { LazyTokenizationSupport, TokenizationRegistry } from 'vscode/vscode/vs/editor/common/languages';
16
17
  import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
17
18
  import { generateTokensCSSForColorMap } from 'vscode/vscode/vs/editor/common/languages/supports/tokenization';
@@ -21,6 +22,7 @@ import { IExtensionResourceLoaderService } from 'vscode/vscode/vs/platform/exten
21
22
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
22
23
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
23
24
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
25
+ import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
24
26
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
25
27
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
26
28
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
@@ -131,13 +133,13 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
131
133
  const tokenType = grammar.tokenTypes[scope];
132
134
  switch (tokenType) {
133
135
  case 'string':
134
- tokenTypes[scope] = 2 ;
136
+ tokenTypes[scope] = StandardTokenType.String;
135
137
  break;
136
138
  case 'other':
137
- tokenTypes[scope] = 0 ;
139
+ tokenTypes[scope] = StandardTokenType.Other;
138
140
  break;
139
141
  case 'comment':
140
- tokenTypes[scope] = 1 ;
142
+ tokenTypes[scope] = StandardTokenType.Comment;
141
143
  break;
142
144
  }
143
145
  }
@@ -173,7 +175,7 @@ let TextMateTokenizationFeature = class TextMateTokenizationFeature extends Disp
173
175
  this._debugMode = true;
174
176
  if (this._debugMode) {
175
177
  this._progressService.withProgress({
176
- location: 15 ,
178
+ location: ProgressLocation.Notification,
177
179
  buttons: [( localizeWithPath(_moduleId, 1, "Stop"))]
178
180
  }, (progress) => {
179
181
  progress.report({
@@ -3,7 +3,7 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
3
  import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
4
4
  import { getTokenClassificationRegistry, typeAndModifierIdPattern } from 'vscode/vscode/vs/platform/theme/common/tokenClassificationRegistry';
5
5
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
6
+ import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
7
7
 
8
8
  const _moduleId = "vs/workbench/services/themes/common/tokenClassificationExtensionPoint";
9
9
  const tokenClassificationRegistry = getTokenClassificationRegistry();
@@ -260,6 +260,6 @@ let TokenClassificationExtensionPointWorkbenchContribution = class TokenClassifi
260
260
  TokenClassificationExtensionPointWorkbenchContribution = ( (__decorate([
261
261
  ( (__param(0, IInstantiationService)))
262
262
  ], TokenClassificationExtensionPointWorkbenchContribution)));
263
- registerWorkbenchContribution2(TokenClassificationExtensionPointWorkbenchContribution.ID, TokenClassificationExtensionPointWorkbenchContribution, 1 );
263
+ registerWorkbenchContribution2(TokenClassificationExtensionPointWorkbenchContribution.ID, TokenClassificationExtensionPointWorkbenchContribution, WorkbenchPhase.BlockStartup);
264
264
 
265
265
  export { TokenClassificationExtensionPoints };