adopt textmate refactoring, fixes #167288 (#168468)

This commit is contained in:
Henning Dieterichs 2022-12-08 16:10:26 +01:00 committed by GitHub
parent 16e1db2452
commit 0931ced737
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 31 additions and 31 deletions

View file

@ -85,7 +85,7 @@
"vscode-policy-watcher": "^1.1.1",
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "7.0.1",
"vscode-textmate": "8.0.0",
"xterm": "5.1.0-beta.63",
"xterm-addon-canvas": "0.3.0-beta.27",
"xterm-addon-search": "0.11.0-beta.7",

View file

@ -23,7 +23,7 @@
"vscode-oniguruma": "1.7.0",
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "7.0.1",
"vscode-textmate": "8.0.0",
"xterm": "5.1.0-beta.63",
"xterm-addon-canvas": "0.3.0-beta.27",
"xterm-addon-search": "0.11.0-beta.7",

View file

@ -10,7 +10,7 @@
"jschardet": "3.0.0",
"tas-client-umd": "0.1.6",
"vscode-oniguruma": "1.7.0",
"vscode-textmate": "7.0.1",
"vscode-textmate": "8.0.0",
"xterm": "5.1.0-beta.63",
"xterm-addon-canvas": "0.3.0-beta.27",
"xterm-addon-search": "0.11.0-beta.7",

View file

@ -63,10 +63,10 @@ vscode-oniguruma@1.7.0:
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b"
integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==
vscode-textmate@7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-7.0.1.tgz#8118a32b02735dccd14f893b495fa5389ad7de79"
integrity sha512-zQ5U/nuXAAMsh691FtV0wPz89nSkHbs+IQV8FDk+wew9BlSDhf4UmWGlWJfTR2Ti6xZv87Tj5fENzKf6Qk7aLw==
vscode-textmate@8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
xterm-addon-canvas@0.3.0-beta.27:
version "0.3.0-beta.27"

View file

@ -757,10 +757,10 @@ vscode-regexpp@^3.1.0:
resolved "https://registry.yarnpkg.com/vscode-regexpp/-/vscode-regexpp-3.1.0.tgz#42d059b6fffe99bd42939c0d013f632f0cad823f"
integrity sha512-pqtN65VC1jRLawfluX4Y80MMG0DHJydWhe5ZwMHewZD6sys4LbU6lHwFAHxeuaVE6Y6+xZOtAw+9hvq7/0ejkg==
vscode-textmate@7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-7.0.1.tgz#8118a32b02735dccd14f893b495fa5389ad7de79"
integrity sha512-zQ5U/nuXAAMsh691FtV0wPz89nSkHbs+IQV8FDk+wew9BlSDhf4UmWGlWJfTR2Ti6xZv87Tj5fENzKf6Qk7aLw==
vscode-textmate@8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
vscode-windows-ca-certs@^0.3.0:
version "0.3.0"

View file

@ -22,7 +22,7 @@ import { ILanguageService } from 'vs/editor/common/languages/language';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { findMatchingThemeRule } from 'vs/workbench/services/textMate/common/TMHelper';
import { ITextMateService } from 'vs/workbench/services/textMate/browser/textMate';
import type { IGrammar, IToken, StackElement } from 'vscode-textmate';
import type { IGrammar, IToken, StateStack } from 'vscode-textmate';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { ColorThemeData, TokenStyleDefinitions, TokenStyleDefinition, TextMateThemingRuleDefinitions } from 'vs/workbench/services/themes/common/colorThemeData';
@ -511,8 +511,8 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
};
}
private _getStateBeforeLine(grammar: IGrammar, lineNumber: number): StackElement | null {
let state: StackElement | null = null;
private _getStateBeforeLine(grammar: IGrammar, lineNumber: number): StateStack | null {
let state: StateStack | null = null;
for (let i = 1; i < lineNumber; i++) {
const tokenizationResult = grammar.tokenizeLine(this._model.getLineContent(i), state);

View file

@ -11,7 +11,7 @@ import { IWorkbenchThemeService, IWorkbenchColorTheme } from 'vs/workbench/servi
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { EditorResourceAccessor } from 'vs/workbench/common/editor';
import { ITextMateService } from 'vs/workbench/services/textMate/browser/textMate';
import type { IGrammar, StackElement } from 'vscode-textmate';
import type { IGrammar, StateStack } from 'vscode-textmate';
import { TokenizationRegistry } from 'vs/editor/common/languages';
import { TokenMetadata } from 'vs/editor/common/encodedTokenAttributes';
import { ThemeRule, findMatchingThemeRule } from 'vs/workbench/services/textMate/common/TMHelper';
@ -98,7 +98,7 @@ class Snapper {
private _themedTokenize(grammar: IGrammar, lines: string[]): IThemedToken[] {
const colorMap = TokenizationRegistry.getColorMap();
let state: StackElement | null = null;
let state: StateStack | null = null;
const result: IThemedToken[] = [];
let resultLen = 0;
for (let i = 0, len = lines.length; i < len; i++) {
@ -127,7 +127,7 @@ class Snapper {
}
private _tokenize(grammar: IGrammar, lines: string[]): IToken[] {
let state: StackElement | null = null;
let state: StateStack | null = null;
const result: IToken[] = [];
let resultLen = 0;
for (let i = 0, len = lines.length; i < len; i++) {

View file

@ -23,7 +23,7 @@ import { ExtensionMessageCollector } from 'vs/workbench/services/extensions/comm
import { ITMSyntaxExtensionPoint, grammarsExtPoint } from 'vs/workbench/services/textMate/common/TMGrammars';
import { ITextMateService } from 'vs/workbench/services/textMate/browser/textMate';
import { ITextMateThemingRule, IWorkbenchThemeService, IWorkbenchColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import type { IGrammar, StackElement, IOnigLib, IRawTheme } from 'vscode-textmate';
import type { IGrammar, StateStack, IOnigLib, IRawTheme } from 'vscode-textmate';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IValidGrammarDefinition, IValidEmbeddedLanguagesMap, IValidTokenTypeMap } from 'vs/workbench/services/textMate/common/TMScopeRegistry';
@ -449,7 +449,7 @@ class TMTokenizationSupportWithLineLimit implements ITokenizationSupport {
throw new Error('Not supported!');
}
tokenizeEncoded(line: string, hasEOL: boolean, state: StackElement): EncodedTokenizationResult {
tokenizeEncoded(line: string, hasEOL: boolean, state: StateStack): EncodedTokenizationResult {
// Do not attempt to tokenize if a line is too long
if (line.length >= this._maxTokenizationLineLength) {
return nullTokenizeEncoded(this._encodedLanguageId, state);

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import type { IGrammar, Registry, StackElement, IRawTheme, IOnigLib } from 'vscode-textmate';
import type { IGrammar, Registry, StateStack, IOnigLib, IRawTheme } from 'vscode-textmate';
import { Disposable } from 'vs/base/common/lifecycle';
import { TMScopeRegistry, IValidGrammarDefinition, IValidEmbeddedLanguagesMap } from 'vs/workbench/services/textMate/common/TMScopeRegistry';
@ -17,7 +17,7 @@ interface ITMGrammarFactoryHost {
export interface ICreateGrammarResult {
languageId: string;
grammar: IGrammar | null;
initialState: StackElement;
initialState: StateStack;
containsEmbeddedLanguages: boolean;
}
@ -26,7 +26,7 @@ export const missingTMGrammarErrorMessage = 'No TM Grammar registered for this l
export class TMGrammarFactory extends Disposable {
private readonly _host: ITMGrammarFactoryHost;
private readonly _initialState: StackElement;
private readonly _initialState: StateStack;
private readonly _scopeRegistry: TMScopeRegistry;
private readonly _injections: { [scopeName: string]: string[] };
private readonly _injectedEmbeddedLanguages: { [scopeName: string]: IValidEmbeddedLanguagesMap[] };

View file

@ -6,7 +6,7 @@
import { Emitter, Event } from 'vs/base/common/event';
import { IState, ITokenizationSupport, TokenizationResult, EncodedTokenizationResult } from 'vs/editor/common/languages';
import { LanguageId, TokenMetadata } from 'vs/editor/common/encodedTokenAttributes';
import type { IGrammar, StackElement } from 'vscode-textmate';
import type { IGrammar, StateStack } from 'vscode-textmate';
import { Disposable } from 'vs/base/common/lifecycle';
export class TMTokenization extends Disposable implements ITokenizationSupport {
@ -14,12 +14,12 @@ export class TMTokenization extends Disposable implements ITokenizationSupport {
private readonly _grammar: IGrammar;
private readonly _containsEmbeddedLanguages: boolean;
private readonly _seenLanguages: boolean[];
private readonly _initialState: StackElement;
private readonly _initialState: StateStack;
private readonly _onDidEncounterLanguage: Emitter<LanguageId> = this._register(new Emitter<LanguageId>());
public readonly onDidEncounterLanguage: Event<LanguageId> = this._onDidEncounterLanguage.event;
constructor(grammar: IGrammar, initialState: StackElement, containsEmbeddedLanguages: boolean) {
constructor(grammar: IGrammar, initialState: StateStack, containsEmbeddedLanguages: boolean) {
super();
this._grammar = grammar;
this._initialState = initialState;
@ -35,7 +35,7 @@ export class TMTokenization extends Disposable implements ITokenizationSupport {
throw new Error('Not supported!');
}
public tokenizeEncoded(line: string, hasEOL: boolean, state: StackElement): EncodedTokenizationResult {
public tokenizeEncoded(line: string, hasEOL: boolean, state: StateStack): EncodedTokenizationResult {
const textMateResult = this._grammar.tokenizeLine2(line, state, 500);
if (textMateResult.stoppedEarly) {
@ -60,7 +60,7 @@ export class TMTokenization extends Disposable implements ITokenizationSupport {
}
}
let endState: StackElement;
let endState: StateStack;
// try to save an object if possible
if (state.equals(textMateResult.ruleStack)) {
endState = state;

View file

@ -11295,10 +11295,10 @@ vscode-regexpp@^3.1.0:
resolved "https://registry.yarnpkg.com/vscode-regexpp/-/vscode-regexpp-3.1.0.tgz#42d059b6fffe99bd42939c0d013f632f0cad823f"
integrity sha512-pqtN65VC1jRLawfluX4Y80MMG0DHJydWhe5ZwMHewZD6sys4LbU6lHwFAHxeuaVE6Y6+xZOtAw+9hvq7/0ejkg==
vscode-textmate@7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-7.0.1.tgz#8118a32b02735dccd14f893b495fa5389ad7de79"
integrity sha512-zQ5U/nuXAAMsh691FtV0wPz89nSkHbs+IQV8FDk+wew9BlSDhf4UmWGlWJfTR2Ti6xZv87Tj5fENzKf6Qk7aLw==
vscode-textmate@8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
vscode-uri@^3.0.6:
version "3.0.6"