Skip to content

Commit 59cd6e4

Browse files
authored
Merge pull request microsoft#156807 from microsoft/tyriar/156806
Support default icon/color in folder scope
2 parents ef65649 + ca1c8c7 commit 59cd6e4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
116116
}
117117
}
118118

119-
getDefaultIcon(): TerminalIcon & ThemeIcon {
120-
return this._iconRegistry.getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon)) || Codicon.terminal;
119+
getDefaultIcon(resource?: URI): TerminalIcon & ThemeIcon {
120+
return this._iconRegistry.getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon, { resource })) || Codicon.terminal;
121121
}
122122

123123
async resolveShellLaunchConfig(shellLaunchConfig: IShellLaunchConfig, options: IShellLaunchConfigResolveOptions): Promise<void> {
@@ -145,9 +145,10 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
145145

146146
// Verify the icon is valid, and fallback correctly to the generic terminal id if there is
147147
// an issue
148+
const resource = shellLaunchConfig === undefined || typeof shellLaunchConfig.cwd === 'string' ? undefined : shellLaunchConfig.cwd;
148149
shellLaunchConfig.icon = this._getCustomIcon(shellLaunchConfig.icon)
149150
|| this._getCustomIcon(resolvedProfile.icon)
150-
|| this.getDefaultIcon();
151+
|| this.getDefaultIcon(resource);
151152

152153
// Override the name if specified
153154
if (resolvedProfile.overrideName) {
@@ -157,7 +158,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
157158
// Apply the color
158159
shellLaunchConfig.color = shellLaunchConfig.color
159160
|| resolvedProfile.color
160-
|| this._configurationService.getValue(TerminalSettingId.TabsDefaultColor);
161+
|| this._configurationService.getValue(TerminalSettingId.TabsDefaultColor, { resource });
161162

162163
// Resolve useShellEnvironment based on the setting if it's not set
163164
if (shellLaunchConfig.useShellEnvironment === undefined) {

src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ const terminalConfiguration: IConfigurationNode = {
4242
},
4343
[TerminalSettingId.TabsDefaultColor]: {
4444
description: localize('terminal.integrated.tabs.defaultColor', "A theme color ID to associate with terminal icons by default."),
45-
...terminalColorSchema
45+
...terminalColorSchema,
46+
scope: ConfigurationScope.RESOURCE
4647
},
4748
[TerminalSettingId.TabsDefaultIcon]: {
4849
description: localize('terminal.integrated.tabs.defaultIcon', "A codicon ID to associate with terminal icons by default."),
4950
...terminalIconSchema,
5051
default: Codicon.terminal.id,
52+
scope: ConfigurationScope.RESOURCE
5153
},
5254
[TerminalSettingId.TabsEnabled]: {
5355
description: localize('terminal.integrated.tabs.enabled', 'Controls whether terminal tabs display as a list to the side of the terminal. When this is disabled a dropdown will display instead.'),

0 commit comments

Comments
 (0)