@theia/monaco 1.28.0-next.3 → 1.28.0-next.33

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.
Files changed (57) hide show
  1. package/README.md +56 -0
  2. package/lib/browser/monaco-color-registry.d.ts.map +1 -1
  3. package/lib/browser/monaco-color-registry.js +3 -2
  4. package/lib/browser/monaco-color-registry.js.map +1 -1
  5. package/lib/browser/monaco-command.js +3 -3
  6. package/lib/browser/monaco-command.js.map +1 -1
  7. package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
  8. package/lib/browser/monaco-diff-editor.js +4 -0
  9. package/lib/browser/monaco-diff-editor.js.map +1 -1
  10. package/lib/browser/monaco-editor.d.ts.map +1 -1
  11. package/lib/browser/monaco-editor.js +4 -1
  12. package/lib/browser/monaco-editor.js.map +1 -1
  13. package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
  14. package/lib/browser/monaco-frontend-application-contribution.js +5 -2
  15. package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
  16. package/lib/browser/monaco-indexed-db.d.ts +1 -1
  17. package/lib/browser/monaco-indexed-db.d.ts.map +1 -1
  18. package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
  19. package/lib/browser/monaco-quick-input-service.js +1 -1
  20. package/lib/browser/monaco-quick-input-service.js.map +1 -1
  21. package/lib/browser/monaco-text-model-service.d.ts.map +1 -1
  22. package/lib/browser/monaco-text-model-service.js +15 -17
  23. package/lib/browser/monaco-text-model-service.js.map +1 -1
  24. package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +1 -1
  25. package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts.map +1 -1
  26. package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +38 -6
  27. package/lib/browser/textmate/monaco-textmate-frontend-bindings.js.map +1 -1
  28. package/lib/browser/textmate/monaco-textmate-service.d.ts +3 -3
  29. package/lib/browser/textmate/monaco-textmate-service.d.ts.map +1 -1
  30. package/lib/browser/textmate/monaco-textmate-service.js +8 -30
  31. package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
  32. package/lib/browser/textmate/monaco-theme-registry.d.ts +2 -7
  33. package/lib/browser/textmate/monaco-theme-registry.d.ts.map +1 -1
  34. package/lib/browser/textmate/monaco-theme-registry.js +9 -3
  35. package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
  36. package/lib/browser/textmate/monaco-theme-types.d.ts +11 -0
  37. package/lib/browser/textmate/monaco-theme-types.d.ts.map +1 -1
  38. package/lib/browser/textmate/monaco-theme-types.js +3 -0
  39. package/lib/browser/textmate/monaco-theme-types.js.map +1 -1
  40. package/lib/browser/textmate/textmate-tokenizer.d.ts +0 -8
  41. package/lib/browser/textmate/textmate-tokenizer.d.ts.map +1 -1
  42. package/lib/browser/textmate/textmate-tokenizer.js +7 -20
  43. package/lib/browser/textmate/textmate-tokenizer.js.map +1 -1
  44. package/package.json +10 -10
  45. package/src/browser/monaco-color-registry.ts +2 -1
  46. package/src/browser/monaco-command.ts +3 -3
  47. package/src/browser/monaco-diff-editor.ts +4 -0
  48. package/src/browser/monaco-editor.ts +4 -1
  49. package/src/browser/monaco-frontend-application-contribution.ts +5 -2
  50. package/src/browser/monaco-indexed-db.ts +1 -1
  51. package/src/browser/monaco-quick-input-service.ts +2 -3
  52. package/src/browser/monaco-text-model-service.ts +15 -16
  53. package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +36 -6
  54. package/src/browser/textmate/monaco-textmate-service.ts +6 -29
  55. package/src/browser/textmate/monaco-theme-registry.ts +7 -10
  56. package/src/browser/textmate/monaco-theme-types.ts +12 -0
  57. package/src/browser/textmate/textmate-tokenizer.ts +6 -19
@@ -74,7 +74,10 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
74
74
  // Monaco registers certain quick access providers (e.g. QuickCommandAccess) at import time, but we want to use our own.
75
75
  this.quickAccessRegistry.clear();
76
76
 
77
- // Incomparability of enum types between public and private API's
77
+ /**
78
+ * @monaco-uplift.Should be guaranteed to work.
79
+ * Incomparable enums prevent TypeScript from believing that public ITextModel satisfied private ITextModel
80
+ */
78
81
  setSnippetSuggestSupport(this.snippetSuggestProvider as unknown as CompletionItemProvider);
79
82
 
80
83
  for (const language of monaco.languages.getLanguages()) {
@@ -167,7 +170,7 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
167
170
  new editorBoolConstructor(id++, 'wordBasedSuggestions', true, editorGeneratedPreferenceProperties['editor.wordBasedSuggestions']),
168
171
  new editorStringEnumConstructor(id++, 'wordBasedSuggestionsMode', 'matchingDocuments', editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode'].enum, editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode']),
169
172
  new editorBoolConstructor(id++, 'stablePeek', false, editorGeneratedPreferenceProperties['editor.stablePeek']),
170
- new editorIntConstructor(id++, 'maxTokenizationLength', 20000, 1, MAX_SAFE_INTEGER, editorGeneratedPreferenceProperties['editor.maxTokenizationLength']),
173
+ new editorIntConstructor(id++, 'maxTokenizationLineLength', 20000, 1, MAX_SAFE_INTEGER, editorGeneratedPreferenceProperties['editor.maxTokenizationLineLength']),
171
174
  );
172
175
  }
173
176
  }
@@ -19,7 +19,7 @@ import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposa
19
19
  import { ThemeService } from '@theia/core/lib/browser/theming';
20
20
  import * as monaco from '@theia/monaco-editor-core';
21
21
  import { injectable } from '@theia/core/shared/inversify';
22
- import type { ThemeMix } from './textmate/monaco-theme-registry';
22
+ import type { ThemeMix } from './textmate/monaco-theme-types';
23
23
  import { Theme } from '@theia/core/lib/common/theme';
24
24
 
25
25
  let _monacoDB: Promise<idb.IDBPDatabase> | undefined;
@@ -214,7 +214,7 @@ export class MonacoQuickInputService implements QuickInputService {
214
214
  }
215
215
 
216
216
  createInputBox(): InputBox {
217
- return this.monacoService.createInputBox() as unknown as InputBox;
217
+ return this.monacoService.createInputBox();
218
218
  }
219
219
 
220
220
  input(options?: InputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
@@ -253,6 +253,7 @@ export class MonacoQuickInputService implements QuickInputService {
253
253
  return new Promise<T | undefined>((resolve, reject) => {
254
254
  const quickPick = this.monacoService.createQuickPick<MonacoQuickPickItem<T>>();
255
255
  const wrapped = this.wrapQuickPick(quickPick);
256
+ wrapped.items = items;
256
257
 
257
258
  if (options) {
258
259
  wrapped.canSelectMany = !!options.canSelectMany;
@@ -321,8 +322,6 @@ export class MonacoQuickInputService implements QuickInputService {
321
322
  }
322
323
  });
323
324
  }
324
-
325
- wrapped.items = items;
326
325
  wrapped.show();
327
326
  }).then(item => {
328
327
  if (item?.execute) {
@@ -134,7 +134,9 @@ export class MonacoTextModelService implements ITextModelService {
134
134
  switch (editorPreference) {
135
135
  case 'editor.tabSize': return 'tabSize';
136
136
  case 'editor.insertSpaces': return 'insertSpaces';
137
- case 'editor.bracketPairColorization.enabled': return 'bracketColorizationOptions';
137
+ case 'editor.bracketPairColorization.enabled':
138
+ case 'editor.bracketPairColorization.independentColorPoolPerBracketType':
139
+ return 'bracketColorizationOptions';
138
140
  case 'editor.trimAutoWhitespace': return 'trimAutoWhitespace';
139
141
 
140
142
  }
@@ -142,28 +144,21 @@ export class MonacoTextModelService implements ITextModelService {
142
144
  }
143
145
 
144
146
  protected updateModel(model: MonacoEditorModel, change?: EditorPreferenceChange): void {
145
- if (change) {
146
- if (!change.affects(model.uri, model.languageId)) {
147
- return;
148
- }
147
+ if (!change) {
148
+ model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
149
+ model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
150
+ model.textEditorModel.updateOptions(this.getModelOptions(model));
151
+ } else if (change.affects(model.uri, model.languageId)) {
149
152
  if (change.preferenceName === 'files.autoSave') {
150
153
  model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
151
154
  }
152
155
  if (change.preferenceName === 'files.autoSaveDelay') {
153
156
  model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
154
157
  }
155
- const modelOption = this.modelOptions[change.preferenceName];
158
+ const modelOption = this.toModelOption(change.preferenceName);
156
159
  if (modelOption) {
157
- const options: ITextModelUpdateOptions = {};
158
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
- const newValue = change.newValue as any;
160
- options[modelOption] = change.preferenceName === 'editor.bracketPairColorization.enabled' ? { enabled: newValue } : newValue;
161
- model.textEditorModel.updateOptions(options);
160
+ model.textEditorModel.updateOptions(this.getModelOptions(model));
162
161
  }
163
- } else {
164
- model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
165
- model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
166
- model.textEditorModel.updateOptions(this.getModelOptions(model));
167
162
  }
168
163
  }
169
164
 
@@ -176,7 +171,11 @@ export class MonacoTextModelService implements ITextModelService {
176
171
  return {
177
172
  tabSize: this.editorPreferences.get({ preferenceName: 'editor.tabSize', overrideIdentifier }, undefined, uri),
178
173
  insertSpaces: this.editorPreferences.get({ preferenceName: 'editor.insertSpaces', overrideIdentifier }, undefined, uri),
179
- bracketColorizationOptions: { enabled: this.editorPreferences.get({ preferenceName: 'editor.bracketPairColorization.enabled', overrideIdentifier }, undefined, uri) },
174
+ bracketColorizationOptions: {
175
+ enabled: this.editorPreferences.get({ preferenceName: 'editor.bracketPairColorization.enabled', overrideIdentifier }, undefined, uri),
176
+ independentColorPoolPerBracketType: this.editorPreferences.get(
177
+ { preferenceName: 'editor.bracketPairColorization.independentColorPoolPerBracketType', overrideIdentifier }, undefined, uri),
178
+ },
180
179
  trimAutoWhitespace: this.editorPreferences.get({ preferenceName: 'editor.trimAutoWhitespace', overrideIdentifier }, undefined, uri),
181
180
  };
182
181
  }
@@ -19,17 +19,18 @@ import { FrontendApplicationContribution, isBasicWasmSupported } from '@theia/co
19
19
  import { bindContributionProvider } from '@theia/core';
20
20
  import { TextmateRegistry } from './textmate-registry';
21
21
  import { LanguageGrammarDefinitionContribution } from './textmate-contribution';
22
- import { MonacoTextmateService, OnigasmPromise } from './monaco-textmate-service';
22
+ import { MonacoTextmateService } from './monaco-textmate-service';
23
23
  import { MonacoThemeRegistry } from './monaco-theme-registry';
24
- import { loadWASM, OnigScanner, OnigString } from 'onigasm';
25
- import { IOnigLib } from 'vscode-textmate';
24
+ import { loadWASM, createOnigScanner, OnigScanner, createOnigString, OnigString } from 'vscode-oniguruma';
25
+ import { IOnigLib, IRawGrammar, parseRawGrammar, Registry } from 'vscode-textmate';
26
+ import { OnigasmPromise, TextmateRegistryFactory, ThemeMix } from './monaco-theme-types';
26
27
 
27
28
  export class OnigasmLib implements IOnigLib {
28
29
  createOnigScanner(sources: string[]): OnigScanner {
29
- return new OnigScanner(sources);
30
+ return createOnigScanner(sources);
30
31
  }
31
32
  createOnigString(sources: string): OnigString {
32
- return new OnigString(sources);
33
+ return createOnigString(sources);
33
34
  }
34
35
  }
35
36
 
@@ -40,6 +41,35 @@ export default (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: inter
40
41
  bindContributionProvider(bind, LanguageGrammarDefinitionContribution);
41
42
  bind(TextmateRegistry).toSelf().inSingletonScope();
42
43
  bind(MonacoThemeRegistry).toSelf().inSingletonScope();
44
+ bind(TextmateRegistryFactory).toFactory(({ container }) => (theme?: ThemeMix) => {
45
+ const onigLib = container.get<OnigasmPromise>(OnigasmPromise);
46
+ const textmateRegistry = container.get(TextmateRegistry);
47
+ return new Registry({
48
+ onigLib,
49
+ theme,
50
+ loadGrammar: async (scopeName: string) => {
51
+ const provider = textmateRegistry.getProvider(scopeName);
52
+ if (provider) {
53
+ const definition = await provider.getGrammarDefinition();
54
+ let rawGrammar: IRawGrammar;
55
+ if (typeof definition.content === 'string') {
56
+ rawGrammar = parseRawGrammar(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
57
+ } else {
58
+ rawGrammar = definition.content as IRawGrammar;
59
+ }
60
+ return rawGrammar;
61
+ }
62
+ return undefined;
63
+ },
64
+ getInjections: (scopeName: string) => {
65
+ const provider = textmateRegistry.getProvider(scopeName);
66
+ if (provider && provider.getInjections) {
67
+ return provider.getInjections(scopeName);
68
+ }
69
+ return [];
70
+ }
71
+ });
72
+ });
43
73
  };
44
74
 
45
75
  export async function dynamicOnigasmLib(ctx: interfaces.Context): Promise<IOnigLib> {
@@ -57,7 +87,7 @@ export async function createOnigasmLib(): Promise<IOnigLib> {
57
87
 
58
88
  export async function fetchOnigasm(): Promise<ArrayBuffer> {
59
89
  // Using Webpack's wasm loader should give us a URL to fetch the resource from:
60
- const onigasmPath: string = require('onigasm/lib/onigasm.wasm');
90
+ const onigasmPath: string = require('vscode-oniguruma/release/onig.wasm');
61
91
  const response = await fetch(onigasmPath, { method: 'GET' });
62
92
  return response.arrayBuffer();
63
93
  }
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable, inject, named } from '@theia/core/shared/inversify';
18
- import { Registry, IOnigLib, IRawGrammar, parseRawGrammar } from 'vscode-textmate';
18
+ import { Registry } from 'vscode-textmate';
19
19
  import { ILogger, ContributionProvider, DisposableCollection, Disposable } from '@theia/core';
20
20
  import { FrontendApplicationContribution, isBasicWasmSupported } from '@theia/core/lib/browser';
21
21
  import { ThemeService } from '@theia/core/lib/browser/theming';
@@ -31,9 +31,7 @@ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/stan
31
31
  import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
32
32
  import { TokenizationSupportAdapter } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneLanguages';
33
33
  import { LanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageService';
34
-
35
- export const OnigasmPromise = Symbol('OnigasmPromise');
36
- export type OnigasmPromise = Promise<IOnigLib>;
34
+ import { OnigasmPromise, TextmateRegistryFactory } from './monaco-theme-types';
37
35
 
38
36
  @injectable()
39
37
  export class MonacoTextmateService implements FrontendApplicationContribution {
@@ -67,6 +65,9 @@ export class MonacoTextmateService implements FrontendApplicationContribution {
67
65
  @inject(EditorPreferences)
68
66
  protected readonly preferences: EditorPreferences;
69
67
 
68
+ @inject(TextmateRegistryFactory)
69
+ protected readonly registryFactory: TextmateRegistryFactory;
70
+
70
71
  initialize(): void {
71
72
  if (!isBasicWasmSupported) {
72
73
  console.log('Textmate support deactivated because WebAssembly is not detected.');
@@ -81,31 +82,7 @@ export class MonacoTextmateService implements FrontendApplicationContribution {
81
82
  }
82
83
  }
83
84
 
84
- this.grammarRegistry = new Registry({
85
- getOnigLib: () => this.onigasmPromise,
86
- theme: this.monacoThemeRegistry.getThemeData(this.currentEditorTheme),
87
- loadGrammar: async (scopeName: string) => {
88
- const provider = this.textmateRegistry.getProvider(scopeName);
89
- if (provider) {
90
- const definition = await provider.getGrammarDefinition();
91
- let rawGrammar: IRawGrammar;
92
- if (typeof definition.content === 'string') {
93
- rawGrammar = parseRawGrammar(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
94
- } else {
95
- rawGrammar = definition.content as IRawGrammar;
96
- }
97
- return rawGrammar;
98
- }
99
- return undefined;
100
- },
101
- getInjections: (scopeName: string) => {
102
- const provider = this.textmateRegistry.getProvider(scopeName);
103
- if (provider && provider.getInjections) {
104
- return provider.getInjections(scopeName);
105
- }
106
- return [];
107
- }
108
- });
85
+ this.grammarRegistry = this.registryFactory(this.monacoThemeRegistry.getThemeData(this.currentEditorTheme));
109
86
 
110
87
  this.tokenizerOption.lineLimit = this.preferences['editor.maxTokenizationLineLength'];
111
88
  this.preferences.onPreferenceChanged(e => {
@@ -17,22 +17,20 @@
17
17
 
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
19
 
20
- import { injectable } from '@theia/core/shared/inversify';
21
- import { IRawTheme, Registry, IRawThemeSetting } from 'vscode-textmate';
20
+ import { inject, injectable } from '@theia/core/shared/inversify';
21
+ import { IRawThemeSetting } from 'vscode-textmate';
22
22
  import * as monaco from '@theia/monaco-editor-core';
23
- import { IStandaloneTheme, IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
23
+ import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
24
24
  import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
25
25
  import { StandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneThemeService';
26
26
  import { Color } from '@theia/monaco-editor-core/esm/vs/base/common/color';
27
-
28
- export interface ThemeMix extends IRawTheme, monaco.editor.IStandaloneThemeData { }
29
- export interface MixStandaloneTheme extends IStandaloneTheme {
30
- themeData: ThemeMix
31
- }
27
+ import { MixStandaloneTheme, TextmateRegistryFactory, ThemeMix } from './monaco-theme-types';
32
28
 
33
29
  @injectable()
34
30
  export class MonacoThemeRegistry {
35
31
 
32
+ @inject(TextmateRegistryFactory) protected readonly registryFactory: TextmateRegistryFactory;
33
+
36
34
  initializeDefaultThemes(): void {
37
35
  this.register(require('../../../data/monaco-themes/vscode/dark_theia.json'), {
38
36
  './dark_vs.json': require('../../../data/monaco-themes/vscode/dark_vs.json'),
@@ -129,8 +127,7 @@ export class MonacoThemeRegistry {
129
127
  }
130
128
  });
131
129
 
132
- const reg = new Registry();
133
- reg.setTheme(result);
130
+ const reg = this.registryFactory(result);
134
131
  result.encodedTokensColors = reg.getColorMap();
135
132
  // index 0 has to be set to null as it is 'undefined' by default, but monaco code expects it to be null
136
133
  // eslint-disable-next-line no-null/no-null
@@ -15,6 +15,18 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as monaco from '@theia/monaco-editor-core';
18
+ import { IStandaloneTheme } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
19
+ import { IOnigLib, IRawTheme, Registry } from 'vscode-textmate';
20
+
21
+ export interface ThemeMix extends IRawTheme, monaco.editor.IStandaloneThemeData { }
22
+ export interface MixStandaloneTheme extends IStandaloneTheme {
23
+ themeData: ThemeMix
24
+ }
25
+
26
+ export const OnigasmPromise = Symbol('OnigasmPromise');
27
+ export type OnigasmPromise = Promise<IOnigLib>;
28
+ export const TextmateRegistryFactory = Symbol('TextmateRegistryFactory');
29
+ export type TextmateRegistryFactory = (currentTheme?: ThemeMix) => Registry;
18
30
 
19
31
  export type MonacoThemeColor = monaco.editor.IColors;
20
32
  export interface MonacoTokenRule extends monaco.editor.ITokenThemeRule { };
@@ -49,17 +49,6 @@ export interface TokenizerOption {
49
49
 
50
50
  }
51
51
 
52
- export namespace TokenizerOption {
53
- /**
54
- * The default TextMate tokenizer option.
55
- *
56
- * @deprecated Use the current value of `editor.maxTokenizationLineLength` preference instead.
57
- */
58
- export const DEFAULT: TokenizerOption = {
59
- lineLimit: 400
60
- };
61
- }
62
-
63
52
  export function createTextmateTokenizer(grammar: IGrammar, options: TokenizerOption): monaco.languages.EncodedTokensProvider & monaco.languages.TokensProvider {
64
53
  if (options.lineLimit !== undefined && (options.lineLimit <= 0 || !Number.isInteger(options.lineLimit))) {
65
54
  throw new Error(`The 'lineLimit' must be a positive integer. It was ${options.lineLimit}.`);
@@ -67,24 +56,22 @@ export function createTextmateTokenizer(grammar: IGrammar, options: TokenizerOpt
67
56
  return {
68
57
  getInitialState: () => new TokenizerState(INITIAL),
69
58
  tokenizeEncoded(line: string, state: TokenizerState): monaco.languages.IEncodedLineTokens {
70
- let processedLine = line;
71
59
  if (options.lineLimit !== undefined && line.length > options.lineLimit) {
72
- // Line is too long to be tokenized
73
- processedLine = line.substring(0, options.lineLimit);
60
+ // Skip tokenizing the line if it exceeds the line limit.
61
+ return { endState: state.ruleStack, tokens: new Uint32Array() };
74
62
  }
75
- const result = grammar.tokenizeLine2(processedLine, state.ruleStack);
63
+ const result = grammar.tokenizeLine2(line, state.ruleStack, 500);
76
64
  return {
77
65
  endState: new TokenizerState(result.ruleStack),
78
66
  tokens: result.tokens
79
67
  };
80
68
  },
81
69
  tokenize(line: string, state: TokenizerState): monaco.languages.ILineTokens {
82
- let processedLine = line;
83
70
  if (options.lineLimit !== undefined && line.length > options.lineLimit) {
84
- // Line is too long to be tokenized
85
- processedLine = line.substring(0, options.lineLimit);
71
+ // Skip tokenizing the line if it exceeds the line limit.
72
+ return { endState: state.ruleStack, tokens: [] };
86
73
  }
87
- const result = grammar.tokenizeLine(processedLine, state.ruleStack);
74
+ const result = grammar.tokenizeLine(line, state.ruleStack, 500);
88
75
  return {
89
76
  endState: new TokenizerState(result.ruleStack),
90
77
  tokens: result.tokens.map(t => ({