diff --git a/package.json b/package.json index 6f5e523581c..89c0b962649 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "vscode-proxy-agent": "^0.11.0", "vscode-regexpp": "^3.1.0", "vscode-ripgrep": "^1.12.1", - "vscode-textmate": "5.5.0", + "vscode-textmate": "6.0.0", "xterm": "4.16.0-beta.5", "xterm-addon-search": "0.9.0-beta.6", "xterm-addon-serialize": "0.7.0-beta.3", diff --git a/remote/package.json b/remote/package.json index a5b8aeee5f6..7cdf922710e 100644 --- a/remote/package.json +++ b/remote/package.json @@ -22,7 +22,7 @@ "vscode-proxy-agent": "^0.11.0", "vscode-regexpp": "^3.1.0", "vscode-ripgrep": "^1.12.1", - "vscode-textmate": "5.5.0", + "vscode-textmate": "6.0.0", "xterm": "4.16.0-beta.5", "xterm-addon-search": "0.9.0-beta.6", "xterm-addon-serialize": "0.7.0-beta.3", diff --git a/remote/web/package.json b/remote/web/package.json index f2c6829b29b..103f4ec7601 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -9,7 +9,7 @@ "jschardet": "3.0.0", "tas-client-umd": "0.1.4", "vscode-oniguruma": "1.6.1", - "vscode-textmate": "5.5.0", + "vscode-textmate": "6.0.0", "xterm": "4.16.0-beta.5", "xterm-addon-search": "0.9.0-beta.6", "xterm-addon-unicode11": "0.4.0-beta.1", diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index cc3d4925450..e46625be0ab 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -108,10 +108,10 @@ vscode-oniguruma@1.6.1: resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz#2bf4dfcfe3dd2e56eb549a3068c8ee39e6c30ce5" integrity sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ== -vscode-textmate@5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.5.0.tgz#d83776562c07d1e3181c2c7f1b3d5f20afcab483" - integrity sha512-jToQkPGMNKn0eyKyitYeINJF0NoD240aYyKPIWJv5W2jfPt++jIRg0OSergubtGhbw6SoefkvBYEpX7TsfoSUQ== +vscode-textmate@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-6.0.0.tgz#a3777197235036814ac9a92451492f2748589210" + integrity sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ== xterm-addon-search@0.9.0-beta.6: version "0.9.0-beta.6" diff --git a/remote/yarn.lock b/remote/yarn.lock index 36e98c376c1..6bdc66344ed 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -555,10 +555,10 @@ vscode-ripgrep@^1.12.1: https-proxy-agent "^4.0.0" proxy-from-env "^1.1.0" -vscode-textmate@5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.5.0.tgz#d83776562c07d1e3181c2c7f1b3d5f20afcab483" - integrity sha512-jToQkPGMNKn0eyKyitYeINJF0NoD240aYyKPIWJv5W2jfPt++jIRg0OSergubtGhbw6SoefkvBYEpX7TsfoSUQ== +vscode-textmate@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-6.0.0.tgz#a3777197235036814ac9a92451492f2748589210" + integrity sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ== vscode-windows-ca-certs@^0.3.0: version "0.3.0" diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index d171153ef18..2217211ce54 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -38,7 +38,8 @@ export const enum FontStyle { None = 0, Italic = 1, Bold = 2, - Underline = 4 + Underline = 4, + Strikethrough = 8, } /** @@ -52,14 +53,14 @@ export const enum ColorId { } /** - * A standard token type. Values are 2^x such that a bit mask can be used. + * A standard token type. * @internal */ export const enum StandardTokenType { Other = 0, Comment = 1, String = 2, - RegEx = 4 + RegEx = 3 } /** @@ -74,11 +75,11 @@ export const enum StandardTokenType { * 1098 7654 3210 9876 5432 1098 7654 3210 * - ------------------------------------------- * xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - * bbbb bbbb bfff ffff ffFF FTTT LLLL LLLL + * bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL * - ------------------------------------------- * - L = LanguageId (8 bits) - * - T = StandardTokenType (3 bits) - * - F = FontStyle (3 bits) + * - T = StandardTokenType (2 bits) + * - F = FontStyle (4 bits) * - f = foreground color (9 bits) * - b = background color (9 bits) * @@ -86,14 +87,15 @@ export const enum StandardTokenType { */ export const enum MetadataConsts { LANGUAGEID_MASK = 0b00000000000000000000000011111111, - TOKEN_TYPE_MASK = 0b00000000000000000000011100000000, - FONT_STYLE_MASK = 0b00000000000000000011100000000000, + TOKEN_TYPE_MASK = 0b00000000000000000000001100000000, + FONT_STYLE_MASK = 0b00000000000000000011110000000000, FOREGROUND_MASK = 0b00000000011111111100000000000000, BACKGROUND_MASK = 0b11111111100000000000000000000000, - ITALIC_MASK = 0b00000000000000000000100000000000, - BOLD_MASK = 0b00000000000000000001000000000000, - UNDERLINE_MASK = 0b00000000000000000010000000000000, + ITALIC_MASK = 0b00000000000000000000010000000000, + BOLD_MASK = 0b00000000000000000000100000000000, + UNDERLINE_MASK = 0b00000000000000000001000000000000, + STRIKETHROUGH_MASK = 0b00000000000000000010000000000000, SEMANTIC_USE_ITALIC = 0b00000000000000000000000000000001, SEMANTIC_USE_BOLD = 0b00000000000000000000000000000010, @@ -103,7 +105,7 @@ export const enum MetadataConsts { LANGUAGEID_OFFSET = 0, TOKEN_TYPE_OFFSET = 8, - FONT_STYLE_OFFSET = 11, + FONT_STYLE_OFFSET = 10, FOREGROUND_OFFSET = 14, BACKGROUND_OFFSET = 23 } diff --git a/src/vs/editor/common/modes/languageConfiguration.ts b/src/vs/editor/common/modes/languageConfiguration.ts index 3c8a5c22b45..16bb4342142 100644 --- a/src/vs/editor/common/modes/languageConfiguration.ts +++ b/src/vs/editor/common/modes/languageConfiguration.ts @@ -273,7 +273,9 @@ export class StandardAutoClosingPairConditional { readonly open: string; readonly close: string; - private readonly _standardTokenMask: number; + private readonly _inString: boolean; + private readonly _inComment: boolean; + private readonly _inRegEx: boolean; private _neutralCharacter: string | null = null; private _neutralCharacterSearched: boolean = false; @@ -282,20 +284,22 @@ export class StandardAutoClosingPairConditional { this.close = source.close; // initially allowed in all tokens - this._standardTokenMask = 0; + this._inString = true; + this._inComment = true; + this._inRegEx = true; if (Array.isArray(source.notIn)) { for (let i = 0, len = source.notIn.length; i < len; i++) { const notIn: string = source.notIn[i]; switch (notIn) { case 'string': - this._standardTokenMask |= StandardTokenType.String; + this._inString = false; break; case 'comment': - this._standardTokenMask |= StandardTokenType.Comment; + this._inComment = false; break; case 'regex': - this._standardTokenMask |= StandardTokenType.RegEx; + this._inRegEx = false; break; } } @@ -303,7 +307,16 @@ export class StandardAutoClosingPairConditional { } public isOK(standardToken: StandardTokenType): boolean { - return (this._standardTokenMask & standardToken) === 0; + switch (standardToken) { + case StandardTokenType.Other: + return true; + case StandardTokenType.Comment: + return this._inComment; + case StandardTokenType.String: + return this._inString; + case StandardTokenType.RegEx: + return this._inRegEx; + } } public shouldAutoClose(context: ScopedLineTokens, column: number): boolean { diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 8c34ee60014..8b4345db9a7 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -3310,7 +3310,7 @@ export enum StandardTokenType { Other = 0, Comment = 1, String = 2, - RegEx = 4 + RegEx = 3 } diff --git a/src/vs/workbench/services/textMate/common/textMateService.ts b/src/vs/workbench/services/textMate/common/textMateService.ts index 4dcb0e635de..eda77328d07 100644 --- a/src/vs/workbench/services/textMate/common/textMateService.ts +++ b/src/vs/workbench/services/textMate/common/textMateService.ts @@ -18,14 +18,8 @@ export interface ITextMateService { startDebugMode(printFn: (str: string) => void, onStop: () => void): void; } -// -------------- Types "liberated" from vscode-textmate due to usage in /common/ +// -------------- Types copied from vscode-textmate due to usage in /common/ -export const enum StandardTokenType { - Other = 0, - Comment = 1, - String = 2, - RegEx = 4, -} /** * A grammar */ @@ -57,38 +51,6 @@ export interface ITokenizeLineResult { */ readonly stoppedEarly: boolean; } -/** - * Helpers to manage the "collapsed" metadata of an entire StackElement stack. - * The following assumptions have been made: - * - languageId < 256 => needs 8 bits - * - unique color count < 512 => needs 9 bits - * - * The binary format is: - * - ------------------------------------------- - * 3322 2222 2222 1111 1111 1100 0000 0000 - * 1098 7654 3210 9876 5432 1098 7654 3210 - * - ------------------------------------------- - * xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - * bbbb bbbb bfff ffff ffFF FTTT LLLL LLLL - * - ------------------------------------------- - * - L = LanguageId (8 bits) - * - T = StandardTokenType (3 bits) - * - F = FontStyle (3 bits) - * - f = foreground color (9 bits) - * - b = background color (9 bits) - */ -export const enum MetadataConsts { - LANGUAGEID_MASK = 255, - TOKEN_TYPE_MASK = 1792, - FONT_STYLE_MASK = 14336, - FOREGROUND_MASK = 8372224, - BACKGROUND_MASK = 4286578688, - LANGUAGEID_OFFSET = 0, - TOKEN_TYPE_OFFSET = 8, - FONT_STYLE_OFFSET = 11, - FOREGROUND_OFFSET = 14, - BACKGROUND_OFFSET = 23, -} export interface ITokenizeLineResult2 { /** * The tokens in binary format. Each token occupies two array indices. For token i: diff --git a/src/vscode-dts/vscode.proposed.tokenInformation.d.ts b/src/vscode-dts/vscode.proposed.tokenInformation.d.ts index 538788818d1..1c783b2bdce 100644 --- a/src/vscode-dts/vscode.proposed.tokenInformation.d.ts +++ b/src/vscode-dts/vscode.proposed.tokenInformation.d.ts @@ -11,7 +11,7 @@ declare module 'vscode' { Other = 0, Comment = 1, String = 2, - RegEx = 4 + RegEx = 3 } export interface TokenInformation { diff --git a/yarn.lock b/yarn.lock index 64984ba5264..ded52061f1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10443,10 +10443,10 @@ vscode-telemetry-extractor@^1.9.5: ts-morph "^12.2.0" vscode-ripgrep "^1.12.1" -vscode-textmate@5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.5.0.tgz#d83776562c07d1e3181c2c7f1b3d5f20afcab483" - integrity sha512-jToQkPGMNKn0eyKyitYeINJF0NoD240aYyKPIWJv5W2jfPt++jIRg0OSergubtGhbw6SoefkvBYEpX7TsfoSUQ== +vscode-textmate@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-6.0.0.tgz#a3777197235036814ac9a92451492f2748589210" + integrity sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ== vscode-windows-ca-certs@^0.3.0: version "0.3.0"