提交 5830f685 编写于 作者: M Martin Aeschlimann

auto select theme under development (fixes #62582)

上级 9af78e6f
......@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import * as types from 'vs/base/common/types';
import * as resources from 'vs/base/common/resources';
import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IColorTheme, ExtensionData, IThemeExtensionPoint, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ExtensionData, IThemeExtensionPoint, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ColorThemeData } from 'vs/workbench/services/themes/electron-browser/colorThemeData';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { Event, Emitter } from 'vs/base/common/event';
......@@ -155,7 +155,17 @@ export class ColorThemeStore {
});
}
public getColorThemes(): Promise<IColorTheme[]> {
public findThemeDataByParentLocation(parentLocation: URI): Promise<ColorThemeData[]> {
if (parentLocation) {
return this.getColorThemes().then(allThemes => {
return allThemes.filter(t => t.location && resources.isEqualOrParent(t.location, parentLocation));
});
}
return Promise.resolve([]);
}
public getColorThemes(): Promise<ColorThemeData[]> {
return this.extensionService.whenInstalledExtensionsRegistered().then(_ => {
return this.extensionsColorThemes;
});
......
......@@ -154,6 +154,15 @@ export class FileIconThemeStore {
});
}
public findThemeDataByParentLocation(parentLocation: URI): any {
if (parentLocation) {
return this.getFileIconThemes().then(allThemes => {
return allThemes.filter(t => t.location && resources.isEqualOrParent(t.location, parentLocation));
});
}
return Promise.resolve([]);
}
public getFileIconThemes(): Promise<FileIconThemeData[]> {
return this.extensionService.whenInstalledExtensionsRegistered().then(isReady => {
return this.knownIconThemes;
......
......@@ -257,10 +257,22 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
return Promise.all([
this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => {
return this.setColorTheme(theme && theme.id, undefined);
return this.colorThemeStore.findThemeDataByParentLocation(this.environmentService.extensionDevelopmentLocationURI).then(devThemes => {
if (devThemes.length) {
return this.setColorTheme(devThemes[0].id, ConfigurationTarget.MEMORY);
} else {
return this.setColorTheme(theme && theme.id, undefined);
}
});
}),
this.iconThemeStore.findThemeBySettingsId(iconThemeSetting).then(theme => {
return this.setFileIconTheme(theme && theme.id, undefined);
return this.iconThemeStore.findThemeDataByParentLocation(this.environmentService.extensionDevelopmentLocationURI).then(devThemes => {
if (devThemes.length) {
return this.setFileIconTheme(devThemes[0].id, ConfigurationTarget.MEMORY);
} else {
return this.setFileIconTheme(theme && theme.id, undefined);
}
});
}),
]);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册