Skip to content

Commit 516d459

Browse files
committed
extract theme configuration
1 parent bee6dee commit 516d459

6 files changed

Lines changed: 293 additions & 262 deletions

File tree

src/vs/workbench/contrib/extensions/browser/extensionsActions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
5252
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
5353
import { alert } from 'vs/base/browser/ui/aria/aria';
5454
import { coalesce } from 'vs/base/common/arrays';
55-
import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IWorkbenchFileIconTheme, IWorkbenchColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
55+
import { IWorkbenchThemeService, ThemeSettings, IWorkbenchFileIconTheme, IWorkbenchColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
5656
import { ILabelService } from 'vs/platform/label/common/label';
5757
import { prefersExecuteOnUI, prefersExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
5858
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
@@ -1336,7 +1336,7 @@ export class SetColorThemeAction extends ExtensionAction {
13361336
return;
13371337
}
13381338
let extensionThemes = SetColorThemeAction.getColorThemes(this.colorThemes, this.extension!);
1339-
const currentTheme = this.colorThemes.filter(t => t.settingsId === this.configurationService.getValue(COLOR_THEME_SETTING))[0] || this.workbenchThemeService.getColorTheme();
1339+
const currentTheme = this.colorThemes.filter(t => t.settingsId === this.configurationService.getValue(ThemeSettings.COLOR_THEME))[0] || this.workbenchThemeService.getColorTheme();
13401340
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
13411341
if (showCurrentTheme) {
13421342
extensionThemes = extensionThemes.filter(t => t.id !== currentTheme.id);
@@ -1356,7 +1356,7 @@ export class SetColorThemeAction extends ExtensionAction {
13561356
onDidFocus: item => delayer.trigger(() => this.workbenchThemeService.setColorTheme(item.id, undefined)),
13571357
ignoreFocusLost
13581358
});
1359-
let confValue = this.configurationService.inspect(COLOR_THEME_SETTING);
1359+
let confValue = this.configurationService.inspect(ThemeSettings.COLOR_THEME);
13601360
const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
13611361
return this.workbenchThemeService.setColorTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target);
13621362
}
@@ -1402,7 +1402,7 @@ export class SetFileIconThemeAction extends ExtensionAction {
14021402
return;
14031403
}
14041404
let extensionThemes = SetFileIconThemeAction.getFileIconThemes(this.fileIconThemes, this.extension!);
1405-
const currentTheme = this.fileIconThemes.filter(t => t.settingsId === this.configurationService.getValue(ICON_THEME_SETTING))[0] || this.workbenchThemeService.getFileIconTheme();
1405+
const currentTheme = this.fileIconThemes.filter(t => t.settingsId === this.configurationService.getValue(ThemeSettings.ICON_THEME))[0] || this.workbenchThemeService.getFileIconTheme();
14061406
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
14071407
if (showCurrentTheme) {
14081408
extensionThemes = extensionThemes.filter(t => t.id !== currentTheme.id);
@@ -1422,7 +1422,7 @@ export class SetFileIconThemeAction extends ExtensionAction {
14221422
onDidFocus: item => delayer.trigger(() => this.workbenchThemeService.setFileIconTheme(item.id, undefined)),
14231423
ignoreFocusLost
14241424
});
1425-
let confValue = this.configurationService.inspect(ICON_THEME_SETTING);
1425+
let confValue = this.configurationService.inspect(ThemeSettings.ICON_THEME);
14261426
const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
14271427
return this.workbenchThemeService.setFileIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target);
14281428
}

src/vs/workbench/contrib/themes/browser/themes.contribution.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
1010
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
1111
import { Registry } from 'vs/platform/registry/common/platform';
1212
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
13-
import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IWorkbenchColorTheme, IWorkbenchFileIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
13+
import { IWorkbenchThemeService, ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
1414
import { VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions';
1515
import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
1616
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -62,7 +62,7 @@ export class SelectColorThemeAction extends Action {
6262
const themeId = theme && theme.id !== undefined ? theme.id : currentTheme.id;
6363
let target: ConfigurationTarget | undefined = undefined;
6464
if (applyTheme) {
65-
const confValue = this.configurationService.inspect(COLOR_THEME_SETTING);
65+
const confValue = this.configurationService.inspect(ThemeSettings.COLOR_THEME);
6666
target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
6767
}
6868

@@ -147,7 +147,7 @@ class SelectIconThemeAction extends Action {
147147
const themeId = theme && theme.id !== undefined ? theme.id : currentTheme.id;
148148
let target: ConfigurationTarget | undefined = undefined;
149149
if (applyTheme) {
150-
const confValue = this.configurationService.inspect(ICON_THEME_SETTING);
150+
const confValue = this.configurationService.inspect(ThemeSettings.ICON_THEME);
151151
target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
152152
}
153153
this.themeService.setFileIconTheme(themeId, target).then(undefined,

0 commit comments

Comments
 (0)