Skip to content

Commit

Permalink
listen to activate all languages even witout grammar contributions
Browse files Browse the repository at this point in the history
fix eclipse-theia#7111

Signed-off-by: tom-shan <[email protected]>
  • Loading branch information
tom-shan committed Feb 10, 2020
1 parent d5f3262 commit 48d2c29
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,30 @@ export class PluginContributionHandler {
getInjections: (scopeName: string) =>
this.injections.get(scopeName)!
}));

// load grammars on next tick to await registration of languages from all plugins in current tick
// see https://github.com/eclipse-theia/theia/issues/6907#issuecomment-578600243
setTimeout(() => {
}
}
// load grammars on next tick to await registration of languages from all plugins in current tick
// see https://github.com/eclipse-theia/theia/issues/6907#issuecomment-578600243
setTimeout(() => {
if (grammars && grammars.length) {
for (const grammar of grammars) {
const language = grammar.language;
if (language) {
pushContribution(`grammar.language.${language}.scope`, () => this.grammarsRegistry.mapLanguageIdToTextmateGrammar(language, grammar.scope));
pushContribution(`grammar.language.${language}.configuration`, () => this.grammarsRegistry.registerGrammarConfiguration(language, {
embeddedLanguages: this.convertEmbeddedLanguages(grammar.embeddedLanguages, logError),
tokenTypes: this.convertTokenTypes(grammar.tokenTypes)
}));
pushContribution(`grammar.language.${language}.activation`,
() => this.onDidActivateLanguage(language, () => this.monacoTextmateService.activateLanguage(language))
);
}
});
}
}
}
if (languages && languages.length) {
for (const lang of languages) {
pushContribution(`language.${lang.id}.activation`,
() => this.onDidActivateLanguage(lang.id, () => this.monacoTextmateService.activateLanguage(lang.id)));
}
}
});

pushContribution('commands', () => this.registerCommands(contributions));
pushContribution('menus', () => this.menusContributionHandler.handle(contributions));
Expand Down

0 comments on commit 48d2c29

Please sign in to comment.