mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 14:01:38 +01:00
inspectEditorToken: to work with no grammar
This commit is contained in:
@@ -322,8 +322,15 @@ export abstract class AbstractTextMateService extends Disposable implements ITex
|
||||
}
|
||||
|
||||
public async createGrammar(modeId: string): Promise<IGrammar | null> {
|
||||
const languageId = this._modeService.getLanguageIdentifier(modeId);
|
||||
if (!languageId) {
|
||||
return null;
|
||||
}
|
||||
const grammarFactory = await this._getOrCreateGrammarFactory();
|
||||
const { grammar } = await grammarFactory.createGrammar(this._modeService.getLanguageIdentifier(modeId)!.id);
|
||||
if (!grammarFactory.has(languageId.id)) {
|
||||
return null;
|
||||
}
|
||||
const { grammar } = await grammarFactory.createGrammar(languageId.id);
|
||||
return grammar;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user