提交 4cb80def 编写于 作者: A Alex Dima

Fixes #61912: Account for the fact that modes can be instantiated before all...

Fixes #61912: Account for the fact that modes can be instantiated before all extension points have been handled.
上级 98fbaad2
......@@ -15,6 +15,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import { IFileService } from 'vs/platform/files/common/files';
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ITextMateService } from 'vs/workbench/services/textMate/electron-browser/textMateService';
interface IRegExp {
......@@ -67,12 +68,19 @@ export class LanguageConfigurationFileHandler {
constructor(
@ITextMateService textMateService: ITextMateService,
@IModeService private readonly _modeService: IModeService,
@IFileService private readonly _fileService: IFileService
@IFileService private readonly _fileService: IFileService,
@IExtensionService private readonly _extensionService: IExtensionService
) {
this._done = [];
// Listen for hints that a language configuration is needed/usefull and then load it once
this._modeService.onDidCreateMode((mode) => this._loadConfigurationsForMode(mode.getLanguageIdentifier()));
this._modeService.onDidCreateMode((mode) => {
const languageIdentifier = mode.getLanguageIdentifier();
// Modes can be instantiated before the extension points have finished registering
this._extensionService.whenInstalledExtensionsRegistered().then(() => {
this._loadConfigurationsForMode(languageIdentifier);
});
});
textMateService.onDidEncounterLanguage((languageId) => {
this._loadConfigurationsForMode(this._modeService.getLanguageIdentifier(languageId));
});
......
......@@ -20,6 +20,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import { IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IEmbeddedLanguagesMap, ITMSyntaxExtensionPoint, TokenTypesContribution, grammarsExtPoint } from 'vs/workbench/services/textMate/electron-browser/TMGrammars';
import { ITextMateService } from 'vs/workbench/services/textMate/electron-browser/textMateService';
......@@ -157,7 +158,8 @@ export class TextMateService implements ITextMateService {
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IFileService fileService: IFileService,
@INotificationService notificationService: INotificationService,
@ILogService logService: ILogService
@ILogService logService: ILogService,
@IExtensionService extensionService: IExtensionService
) {
this._styleElement = dom.createStyleSheet();
this._styleElement.className = 'vscode-tokens-styles';
......@@ -202,9 +204,12 @@ export class TextMateService implements ITextMateService {
this._modeService.onDidCreateMode((mode) => {
let modeId = mode.getId();
if (this._languageToScope.has(modeId)) {
this.registerDefinition(modeId);
}
// Modes can be instantiated before the extension points have finished registering
extensionService.whenInstalledExtensionsRegistered().then(() => {
if (this._languageToScope.has(modeId)) {
this.registerDefinition(modeId);
}
});
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册