Merge pull request #156807 from microsoft/tyriar/156806

Support default icon/color in folder scope
This commit is contained in:
Daniel Imms 2022-08-01 09:34:32 -07:00 committed by GitHub
commit 59cd6e48d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -116,8 +116,8 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
}
}
getDefaultIcon(): TerminalIcon & ThemeIcon {
return this._iconRegistry.getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon)) || Codicon.terminal;
getDefaultIcon(resource?: URI): TerminalIcon & ThemeIcon {
return this._iconRegistry.getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon, { resource })) || Codicon.terminal;
}
async resolveShellLaunchConfig(shellLaunchConfig: IShellLaunchConfig, options: IShellLaunchConfigResolveOptions): Promise<void> {
@ -145,9 +145,10 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
// Verify the icon is valid, and fallback correctly to the generic terminal id if there is
// an issue
const resource = shellLaunchConfig === undefined || typeof shellLaunchConfig.cwd === 'string' ? undefined : shellLaunchConfig.cwd;
shellLaunchConfig.icon = this._getCustomIcon(shellLaunchConfig.icon)
|| this._getCustomIcon(resolvedProfile.icon)
|| this.getDefaultIcon();
|| this.getDefaultIcon(resource);
// Override the name if specified
if (resolvedProfile.overrideName) {
@ -157,7 +158,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
// Apply the color
shellLaunchConfig.color = shellLaunchConfig.color
|| resolvedProfile.color
|| this._configurationService.getValue(TerminalSettingId.TabsDefaultColor);
|| this._configurationService.getValue(TerminalSettingId.TabsDefaultColor, { resource });
// Resolve useShellEnvironment based on the setting if it's not set
if (shellLaunchConfig.useShellEnvironment === undefined) {

View file

@ -42,12 +42,14 @@ const terminalConfiguration: IConfigurationNode = {
},
[TerminalSettingId.TabsDefaultColor]: {
description: localize('terminal.integrated.tabs.defaultColor', "A theme color ID to associate with terminal icons by default."),
...terminalColorSchema
...terminalColorSchema,
scope: ConfigurationScope.RESOURCE
},
[TerminalSettingId.TabsDefaultIcon]: {
description: localize('terminal.integrated.tabs.defaultIcon', "A codicon ID to associate with terminal icons by default."),
...terminalIconSchema,
default: Codicon.terminal.id,
scope: ConfigurationScope.RESOURCE
},
[TerminalSettingId.TabsEnabled]: {
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.'),