Skip to content

Commit

Permalink
Merge pull request #157094 from microsoft/tyriar/156503
Browse files Browse the repository at this point in the history
Remove shell decoration icon settings
  • Loading branch information
Tyriar committed Aug 4, 2022
2 parents 21f7df6 + 740ba5c commit b91245d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 52 deletions.
3 changes: 0 additions & 3 deletions src/vs/platform/terminal/common/terminal.ts
Expand Up @@ -109,9 +109,6 @@ export const enum TerminalSettingId {
ShellIntegrationEnabled = 'terminal.integrated.shellIntegration.enabled',
ShellIntegrationShowWelcome = 'terminal.integrated.shellIntegration.showWelcome',
ShellIntegrationDecorationsEnabled = 'terminal.integrated.shellIntegration.decorationsEnabled',
ShellIntegrationDecorationIcon = 'terminal.integrated.shellIntegration.decorationIcon',
ShellIntegrationDecorationIconError = 'terminal.integrated.shellIntegration.decorationIconError',
ShellIntegrationDecorationIconSuccess = 'terminal.integrated.shellIntegration.decorationIconSuccess',
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history',
SmoothScrolling = 'terminal.integrated.smoothScrolling'
}
Expand Down
26 changes: 7 additions & 19 deletions src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.ts
Expand Up @@ -37,7 +37,6 @@ const enum DecorationSelector {
Default = 'default',
Codicon = 'codicon',
XtermDecoration = 'xterm-decoration',
GenericMarkerIcon = 'codicon-circle-small-filled',
OverviewRuler = '.xterm-decoration-overview-ruler'
}

Expand Down Expand Up @@ -79,11 +78,7 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
this._hoverDelayer = this._register(new Delayer(this._configurationService.getValue('workbench.hover.delay')));

this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationIcon) ||
e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationIconSuccess) ||
e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationIconError)) {
this._refreshStyles();
} else if (e.affectsConfiguration(TerminalSettingId.FontSize) || e.affectsConfiguration(TerminalSettingId.LineHeight)) {
if (e.affectsConfiguration(TerminalSettingId.FontSize) || e.affectsConfiguration(TerminalSettingId.LineHeight)) {
this.refreshLayouts();
} else if (e.affectsConfiguration('workbench.colorCustomizations')) {
this._refreshStyles(true);
Expand Down Expand Up @@ -338,7 +333,7 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
element.classList.add(DecorationSelector.CommandDecoration, DecorationSelector.Codicon, DecorationSelector.XtermDecoration);

if (genericMarkProperties) {
element.classList.add(DecorationSelector.DefaultColor, DecorationSelector.GenericMarkerIcon);
element.classList.add(DecorationSelector.DefaultColor, ...Codicon.terminalDecorationMark.classNamesArray);
if (!genericMarkProperties.hoverMessage) {
//disable the mouse pointer
element.classList.add(DecorationSelector.Default);
Expand All @@ -348,12 +343,12 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
this._updateCommandDecorationVisibility(element);
if (exitCode === undefined) {
element.classList.add(DecorationSelector.DefaultColor, DecorationSelector.Default);
element.classList.add(`codicon-${this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationIcon)}`);
element.classList.add(...Codicon.terminalDecorationIncomplete.classNamesArray);
} else if (exitCode) {
element.classList.add(DecorationSelector.ErrorColor);
element.classList.add(`codicon-${this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationIconError)}`);
element.classList.add(...Codicon.terminalDecorationError.classNamesArray);
} else {
element.classList.add(`codicon-${this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationIconSuccess)}`);
element.classList.add(...Codicon.terminalDecorationSuccess.classNamesArray);
}
}
}
Expand Down Expand Up @@ -453,22 +448,15 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
private async _showConfigureCommandDecorationsQuickPick() {
const quickPick = this._quickInputService.createQuickPick();
quickPick.items = [
{ id: 'a', label: localize('changeDefaultIcon', 'Change default icon') },
{ id: 'b', label: localize('changeSuccessIcon', 'Change success icon') },
{ id: 'c', label: localize('changeErrorIcon', 'Change error icon') },
{ type: 'separator' },
{ id: 'd', label: localize('toggleVisibility', 'Toggle visibility') },
{ id: 'a', label: localize('toggleVisibility', 'Toggle visibility') },
];
quickPick.canSelectMany = false;
quickPick.onDidAccept(async e => {
quickPick.hide();
const result = quickPick.activeItems[0];
let iconSetting: string | undefined;
switch (result.id) {
case 'a': iconSetting = TerminalSettingId.ShellIntegrationDecorationIcon; break;
case 'b': iconSetting = TerminalSettingId.ShellIntegrationDecorationIconSuccess; break;
case 'c': iconSetting = TerminalSettingId.ShellIntegrationDecorationIconError; break;
case 'd': this._showToggleVisibilityQuickPick(); break;
case 'a': this._showToggleVisibilityQuickPick(); break;
}
if (iconSetting) {
this._showChangeIconQuickPick(iconSetting);
Expand Down
15 changes: 0 additions & 15 deletions src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts
Expand Up @@ -116,21 +116,6 @@ const terminalConfiguration: IConfigurationNode = {
default: 'view',
description: localize('terminal.integrated.defaultLocation', "Controls where newly created terminals will appear.")
},
[TerminalSettingId.ShellIntegrationDecorationIconSuccess]: {
type: 'string',
default: 'primitive-dot',
markdownDescription: localize('terminal.integrated.shellIntegration.decorationIconSuccess', "Controls the icon that will be used for each command in terminals with shell integration enabled that do not have an associated exit code. Set to {0} to hide the icon or disable decorations with {1}.", '`\"\"`', '`#terminal.integrated.shellIntegration.decorationsEnabled#`')
},
[TerminalSettingId.ShellIntegrationDecorationIconError]: {
type: 'string',
default: 'error-small',
markdownDescription: localize('terminal.integrated.shellIntegration.decorationIconError', "Controls the icon that will be used for each command in terminals with shell integration enabled that do have an associated exit code. Set to {0} to hide the icon or disable decorations with {1}.", '`\"\"`', '`#terminal.integrated.shellIntegration.decorationsEnabled#`')
},
[TerminalSettingId.ShellIntegrationDecorationIcon]: {
type: 'string',
default: 'circle-outline',
markdownDescription: localize('terminal.integrated.shellIntegration.decorationIcon', "Controls the icon that will be used for skipped/empty commands. Set to {0} to hide the icon or disable decorations with {1}.", '`\"\"`', '`#terminal.integrated.shellIntegration.decorationsEnabled#`')
},
[TerminalSettingId.TabsFocusMode]: {
type: 'string',
enum: ['singleClick', 'doubleClick'],
Expand Down
6 changes: 3 additions & 3 deletions test/automation/src/terminal.ts
Expand Up @@ -10,9 +10,9 @@ import { IElement } from './driver';

export enum Selector {
TerminalView = `#terminal`,
CommandDecorationPlaceholder = `.terminal-command-decoration.codicon-circle-outline`,
CommandDecorationSuccess = `.terminal-command-decoration.codicon-primitive-dot`,
CommandDecorationError = `.terminal-command-decoration.codicon-error-small`,
CommandDecorationPlaceholder = `.terminal-command-decoration.codicon-terminal-decoration-incomplete`,
CommandDecorationSuccess = `.terminal-command-decoration.codicon-terminal-decoration-success`,
CommandDecorationError = `.terminal-command-decoration.codicon-terminal-decoration-error`,
Xterm = `#terminal .terminal-wrapper`,
XtermEditor = `.editor-instance .terminal-wrapper`,
TabsEntry = '.terminal-tabs-entry',
Expand Down
12 changes: 0 additions & 12 deletions test/smoke/src/areas/terminal/terminal-shellIntegration.test.ts
Expand Up @@ -51,18 +51,6 @@ export function setup() {
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 1 });
});
});
describe('Custom configuration', function () {
it('Should update and show custom icons', async () => {
await createShellIntegrationProfile();
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 0 });
await terminal.runCommandInTerminal(`echo "foo"`);
await terminal.runCommandInTerminal(`bar`);
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIcon', '"zap"');
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconSuccess', '"zap"');
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconError', '"zap"');
await terminal.assertCommandDecorations(undefined, { updatedIcon: "zap", count: 3 });
});
});
describe('terminal.integrated.shellIntegration.decorationsEnabled should determine gutter and overview ruler decoration visibility', function () {
beforeEach(async () => {
await settingsEditor.clearUserSettings();
Expand Down

0 comments on commit b91245d

Please sign in to comment.