From 0cb1f895225ec4903b2e7a226c5c472b9e90b805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 19 Apr 2022 16:07:17 +0200 Subject: [PATCH] fix: Missing condition --- src/languages/textMate/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/languages/textMate/index.ts b/src/languages/textMate/index.ts index 2725f74..dbf97a0 100644 --- a/src/languages/textMate/index.ts +++ b/src/languages/textMate/index.ts @@ -36,6 +36,9 @@ const languageService = monaco.extra.StandaloneServices.get(monaco.languages.ILa async function createTextMateTokensProvider (languageId: string): Promise { const grammarFactory = getOrCreateGrammarFactory() const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(languageId) + if (!grammarFactory.has(languageId)) { + return null + } const { grammar, initialState, containsEmbeddedLanguages } = await grammarFactory.createGrammar(languageId, encodedLanguageId) if (grammar == null) { return null