提交 b51a48a7 编写于 作者: M Martin Aeschlimann

Handle disabling of the default theme extension. Fixes #44510

上级 1aaf68c2
......@@ -210,6 +210,16 @@ export class ColorThemeData implements IColorTheme {
return themeData;
}
static createLoadedEmptyTheme(id: string, settingsId: string): ColorThemeData {
let themeData = new ColorThemeData();
themeData.id = id;
themeData.label = '';
themeData.settingsId = settingsId;
themeData.isLoaded = true;
themeData.themeTokenColors = [{ settings: {} }];
return themeData;
}
static fromStorageData(input: string): ColorThemeData {
try {
let data = JSON.parse(input);
......
......@@ -51,8 +51,8 @@ export class ColorThemeStore {
public get onDidChange(): Event<ColorThemeData[]> { return this.onDidChangeEmitter.event; }
constructor( @IExtensionService private extensionService: IExtensionService) {
this.extensionsColorThemes = [];
constructor( @IExtensionService private extensionService: IExtensionService, defaultTheme: ColorThemeData) {
this.extensionsColorThemes = [defaultTheme];
this.onDidChangeEmitter = new Emitter<ColorThemeData[]>();
this.initialize();
}
......@@ -98,7 +98,11 @@ export class ColorThemeStore {
collector.warn(nls.localize('invalid.path.1', "Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.", themesExtPoint.name, normalizedAbsolutePath, extensionFolderPath));
}
let themeData = ColorThemeData.fromExtensionTheme(theme, normalizedAbsolutePath, extensionData);
this.extensionsColorThemes.push(themeData);
if (themeData.id === this.extensionsColorThemes[0].id) {
this.extensionsColorThemes[0] = themeData;
} else {
this.extensionsColorThemes.push(themeData);
}
});
}
......
......@@ -102,7 +102,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
@IInstantiationService private instantiationService: IInstantiationService) {
this.container = container;
this.colorThemeStore = new ColorThemeStore(extensionService);
this.colorThemeStore = new ColorThemeStore(extensionService, ColorThemeData.createLoadedEmptyTheme(DEFAULT_THEME_ID, DEFAULT_THEME_SETTING_VALUE));
this.onFileIconThemeChange = new Emitter<IFileIconTheme>();
this.iconThemeStore = new FileIconThemeStore(extensionService);
this.onColorThemeChange = new Emitter<IColorTheme>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册