Skip to content

Commit 7521ebd

Browse files
committed
Adopt latest vscode-textmate (fixes microsoft#84401)
1 parent 2340d87 commit 7521ebd

12 files changed

Lines changed: 31 additions & 276 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"vscode-proxy-agent": "^0.5.2",
5353
"vscode-ripgrep": "^1.5.7",
5454
"vscode-sqlite3": "4.0.9",
55-
"vscode-textmate": "^4.3.0",
55+
"vscode-textmate": "^4.4.0",
5656
"xterm": "4.3.0-beta17",
5757
"xterm-addon-search": "0.4.0-beta4",
5858
"xterm-addon-web-links": "0.2.1",

remote/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"vscode-nsfw": "1.2.8",
2020
"vscode-proxy-agent": "^0.5.2",
2121
"vscode-ripgrep": "^1.5.7",
22-
"vscode-textmate": "^4.3.0",
22+
"vscode-textmate": "^4.4.0",
2323
"xterm": "4.3.0-beta17",
2424
"xterm-addon-search": "0.4.0-beta4",
2525
"xterm-addon-web-links": "0.2.1",

remote/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dependencies": {
55
"onigasm-umd": "^2.2.4",
66
"semver-umd": "^5.5.3",
7-
"vscode-textmate": "^4.3.0",
7+
"vscode-textmate": "^4.4.0",
88
"xterm": "4.3.0-beta17",
99
"xterm-addon-search": "0.4.0-beta4",
1010
"xterm-addon-web-links": "0.2.1",

remote/web/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ semver-umd@^5.5.3:
2424
resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e"
2525
integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw==
2626

27-
vscode-textmate@^4.3.0:
28-
version "4.3.0"
29-
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.3.0.tgz#6e1f0f273d84148cfa1e9c7ed85bd16c974f9f61"
30-
integrity sha512-MhEZ3hvxOVuYGsrRzW/PZLDR2VdtG2+V6TIKPvmE9JT+RAq/OtPlrFd1+ZQwBefoHEhjRNuRJ0OktcFezuxPmg==
27+
vscode-textmate@^4.4.0:
28+
version "4.4.0"
29+
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305"
30+
integrity sha512-dFpm2eK0HwEjeFSD1DDh3j0q47bDSVuZt20RiJWxGqjtm73Wu2jip3C2KaZI3dQx/fSeeXCr/uEN4LNaNj7Ytw==
3131
dependencies:
3232
oniguruma "^7.2.0"
3333

remote/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ vscode-ripgrep@^1.5.7:
399399
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce"
400400
integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ==
401401

402-
vscode-textmate@^4.3.0:
403-
version "4.3.0"
404-
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.3.0.tgz#6e1f0f273d84148cfa1e9c7ed85bd16c974f9f61"
405-
integrity sha512-MhEZ3hvxOVuYGsrRzW/PZLDR2VdtG2+V6TIKPvmE9JT+RAq/OtPlrFd1+ZQwBefoHEhjRNuRJ0OktcFezuxPmg==
402+
vscode-textmate@^4.4.0:
403+
version "4.4.0"
404+
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305"
405+
integrity sha512-dFpm2eK0HwEjeFSD1DDh3j0q47bDSVuZt20RiJWxGqjtm73Wu2jip3C2KaZI3dQx/fSeeXCr/uEN4LNaNj7Ytw==
406406
dependencies:
407407
oniguruma "^7.2.0"
408408

src/typings/vscode-textmate.d.ts

Lines changed: 0 additions & 256 deletions
This file was deleted.

src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
174174
private readonly _notificationService: INotificationService;
175175
private readonly _model: ITextModel;
176176
private readonly _domNode: HTMLElement;
177-
private readonly _grammar: Promise<IGrammar>;
177+
private readonly _grammar: Promise<IGrammar | null>;
178178

179179
constructor(
180180
editor: IActiveCodeEditor,
@@ -212,7 +212,12 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
212212
dom.clearNode(this._domNode);
213213
this._domNode.appendChild(document.createTextNode(nls.localize('inspectTMScopesWidget.loading', "Loading...")));
214214
this._grammar.then(
215-
(grammar) => this._compute(grammar, position),
215+
(grammar) => {
216+
if (!grammar) {
217+
throw new Error(`Could not find grammar for language!`);
218+
}
219+
this._compute(grammar, position);
220+
},
216221
(err) => {
217222
this._notificationService.warn(err);
218223
setTimeout(() => {

src/vs/workbench/contrib/themes/test/electron-browser/themes.test.contribution.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ class Snapper {
216216
public captureSyntaxTokens(fileName: string, content: string): Promise<IToken[]> {
217217
const modeId = this.modeService.getModeIdByFilepathOrFirstLine(URI.file(fileName));
218218
return this.textMateService.createGrammar(modeId!).then((grammar) => {
219+
if (!grammar) {
220+
return [];
221+
}
219222
let lines = content.split(/\r\n|\r|\n/);
220223

221224
let result = this._tokenize(grammar, lines);

src/vs/workbench/services/textMate/browser/abstractTextMateService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ export abstract class AbstractTextMateService extends Disposable implements ITex
218218
return null;
219219
}
220220
const r = await grammarFactory.createGrammar(languageId);
221+
if (!r.grammar) {
222+
return null;
223+
}
221224
const tokenization = new TMTokenization(r.grammar, r.initialState, r.containsEmbeddedLanguages);
222225
tokenization.onDidEncounterLanguage((languageId) => {
223226
if (!this._encounteredLanguages[languageId]) {
@@ -314,7 +317,7 @@ export abstract class AbstractTextMateService extends Disposable implements ITex
314317
return true;
315318
}
316319

317-
public async createGrammar(modeId: string): Promise<IGrammar> {
320+
public async createGrammar(modeId: string): Promise<IGrammar | null> {
318321
const grammarFactory = await this._getOrCreateGrammarFactory();
319322
const { grammar } = await grammarFactory.createGrammar(this._modeService.getLanguageIdentifier(modeId)!.id);
320323
return grammar;

src/vs/workbench/services/textMate/common/TMGrammarFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ITMGrammarFactoryHost {
1818

1919
export interface ICreateGrammarResult {
2020
languageId: LanguageId;
21-
grammar: IGrammar;
21+
grammar: IGrammar | null;
2222
initialState: StackElement;
2323
containsEmbeddedLanguages: boolean;
2424
}

0 commit comments

Comments
 (0)