parent
7a0ce574da
commit
9eaba8944f
7 changed files with 23 additions and 3 deletions
|
@ -560,6 +560,7 @@ export interface ITerminalProfile {
|
|||
args?: string | string[] | undefined;
|
||||
env?: ITerminalEnvironment;
|
||||
overrideName?: boolean;
|
||||
color?: string;
|
||||
icon?: ThemeIcon | URI | { light: URI, dark: URI };
|
||||
}
|
||||
|
||||
|
@ -582,6 +583,7 @@ export interface IBaseUnresolvedTerminalProfile {
|
|||
isAutoDetected?: boolean;
|
||||
overrideName?: boolean;
|
||||
icon?: ThemeIcon | URI | { light: URI, dark: URI };
|
||||
color?: string;
|
||||
env?: ITerminalEnvironment;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,10 @@ const terminalProfileSchema: IJSONSchema = {
|
|||
enum: Array.from(iconRegistry.all, icon => icon.id),
|
||||
markdownEnumDescriptions: Array.from(iconRegistry.all, icon => `$(${icon.id})`),
|
||||
},
|
||||
color: {
|
||||
description: localize('terminalProfile.color', 'A theme color ID to associate with this terminal.'),
|
||||
type: 'string'
|
||||
},
|
||||
env: {
|
||||
markdownDescription: localize('terminalProfile.env', "An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment."),
|
||||
type: 'object',
|
||||
|
@ -204,6 +208,10 @@ const terminalPlatformConfiguration: IConfigurationNode = {
|
|||
enum: Array.from(iconRegistry.all, icon => icon.id),
|
||||
markdownEnumDescriptions: Array.from(iconRegistry.all, icon => `$(${icon.id})`),
|
||||
},
|
||||
color: {
|
||||
description: localize('terminalProfile.color', 'A theme color ID to associate with this terminal.'),
|
||||
type: 'string'
|
||||
},
|
||||
env: {
|
||||
markdownDescription: localize('terminalProfile.env', "An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment."),
|
||||
type: 'object',
|
||||
|
@ -385,6 +393,9 @@ function createProfileDescription(profile: ITerminalProfile): string {
|
|||
if (profile.overrideName !== undefined) {
|
||||
description += `\n- overrideName: ${profile.overrideName}`;
|
||||
}
|
||||
if (profile.color) {
|
||||
description += `\n- color: ${profile.color}`;
|
||||
}
|
||||
if (profile.env) {
|
||||
description += `\n- env: ${JSON.stringify(profile.env)}`;
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ async function transformToTerminalProfiles(
|
|||
if (validatedProfile) {
|
||||
validatedProfile.isAutoDetected = profile.isAutoDetected;
|
||||
validatedProfile.icon = icon;
|
||||
validatedProfile.color = profile.color;
|
||||
resultProfiles.push(validatedProfile);
|
||||
} else {
|
||||
logService?.trace('profile not validated', profileName, originalPaths);
|
||||
|
|
|
@ -14,9 +14,9 @@ import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/termina
|
|||
export function getColorClass(terminal: ITerminalInstance): string | undefined {
|
||||
let color = undefined;
|
||||
if (terminal.color) {
|
||||
color = terminal.color;
|
||||
color = terminal.color.replace(/\./g, '_');
|
||||
} else if (ThemeIcon.isThemeIcon(terminal.icon) && terminal.icon.color) {
|
||||
color = terminal.icon.color.id.replace('.', '_');
|
||||
color = terminal.icon.color.id.replace(/\./g, '_');
|
||||
}
|
||||
if (color) {
|
||||
return `terminal-icon-${color}`;
|
||||
|
|
|
@ -336,6 +336,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||
}
|
||||
|
||||
private _getColor(): string | undefined {
|
||||
console.log('_getColor', this.shellLaunchConfig.color);
|
||||
if (this.shellLaunchConfig.color) {
|
||||
return this.shellLaunchConfig.color;
|
||||
}
|
||||
|
@ -1821,7 +1822,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||
const items: IQuickPickItem[] = [];
|
||||
for (const color of colors) {
|
||||
items.push({
|
||||
label: `$(${Codicon.circleFilled.id}) ${color.replace('terminal.ansi', '')}`, id: `${color.replace(/\./g, '_')}`, description: `${color}`, iconClasses: [`terminal-icon-${color.replace(/\./g, '_')}`]
|
||||
label: `$(${Codicon.circleFilled.id}) ${color.replace('terminal.ansi', '')}`, id: color, description: color, iconClasses: [`terminal-icon-${color.replace(/\./g, '_')}`]
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -113,11 +113,15 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
// Verify the icon is valid, and fallback correctly to the generic terminal id if there is
|
||||
// an issue
|
||||
shellLaunchConfig.icon = this._getCustomIcon(shellLaunchConfig.icon) || this._getCustomIcon(resolvedProfile.icon) || Codicon.terminal;
|
||||
|
||||
// Override the name if specified
|
||||
if (resolvedProfile.overrideName) {
|
||||
shellLaunchConfig.name = resolvedProfile.profileName;
|
||||
}
|
||||
|
||||
// TODO: Verify
|
||||
shellLaunchConfig.color = resolvedProfile.color;
|
||||
|
||||
// Resolve useShellEnvironment based on the setting if it's not set
|
||||
if (shellLaunchConfig.useShellEnvironment === undefined) {
|
||||
shellLaunchConfig.useShellEnvironment = this._configurationService.getValue(TerminalSettingId.InheritEnv);
|
||||
|
|
|
@ -1007,6 +1007,7 @@ export class TerminalService implements ITerminalService {
|
|||
args: profile.args,
|
||||
env: profile.env,
|
||||
icon: profile.icon,
|
||||
color: profile.color,
|
||||
name: profile.overrideName ? profile.profileName : undefined,
|
||||
cwd
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue