Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Apr 23, 2021
1 parent b2c250f commit a0804b6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/terminal/browser/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export interface ITerminalInstance {
readonly rows: number;
readonly maxCols: number;
readonly maxRows: number;
readonly icon: Codicon;
readonly icon?: Codicon;

readonly statusList: ITerminalStatusList;

Expand Down
10 changes: 5 additions & 5 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
public get commandTracker(): CommandTrackerAddon | undefined { return this._commandTrackerAddon; }
public get navigationMode(): INavigationMode | undefined { return this._navigationModeAddon; }
public get isDisconnected(): boolean { return this._processManager.isDisconnected; }
public get icon(): Codicon { return this._getIcon(); }
public get icon(): Codicon | undefined { return this._getIcon(); }

private readonly _onExit = new Emitter<number | undefined>();
public get onExit(): Event<number | undefined> { return this._onExit.event; }
Expand Down Expand Up @@ -317,13 +317,13 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
});
}

private _getIcon(): Codicon {
private _getIcon(): Codicon | undefined {
if (this.shellLaunchConfig.icon) {
return iconRegistry.get(this.shellLaunchConfig.icon) || Codicon.terminal;
return iconRegistry.get(this.shellLaunchConfig.icon);
} else if (this.shellLaunchConfig?.attachPersistentProcess?.icon) {
return iconRegistry.get(this.shellLaunchConfig.attachPersistentProcess.icon) || Codicon.terminal;
return iconRegistry.get(this.shellLaunchConfig.attachPersistentProcess.icon);
}
return Codicon.terminal;
return undefined;
}

public addDisposable(disposable: IDisposable): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider<IPick
const terminalTab = terminalTabs[tabIndex];
for (let terminalIndex = 0; terminalIndex < terminalTab.terminalInstances.length; terminalIndex++) {
const terminal = terminalTab.terminalInstances[terminalIndex];
const label = `$(${terminal.icon.id}) ${tabIndex + 1}.${terminalIndex + 1}: ${terminal.title}`;
const label = `$(${terminal.icon?.id}) ${tabIndex + 1}.${terminalIndex + 1}: ${terminal.title}`;

const highlights = matchesFuzzy(filter, label, true);
if (highlights) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ class TerminalTabsRenderer implements ITreeRenderer<ITerminalInstance, never, IT
template.actionBar.clear();
const primaryStatus = instance.statusList.primary;
if (primaryStatus && primaryStatus.severity >= Severity.Warning) {
label = `${prefix}$(${primaryStatus.icon?.id || instance.icon.id})`;
label = `${prefix}$(${primaryStatus.icon?.id || instance.icon?.id})`;
} else {
label = `${prefix}$(${instance.icon.id})`;
label = `${prefix}$(${instance.icon?.id})`;
}
} else {
this.fillActionBar(instance, template);
// Remove "Task - " from only tabs to give more horizontal space as it's obvious from
// the tab icon
label = `${prefix}$(${instance.icon.id}) ${instance.title.replace(/^Task - /, '')}`;
label = `${prefix}$(${instance.icon?.id}) ${instance.title.replace(/^Task - /, '')}`;
}

if (!template.elementDispoables) {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/terminal/browser/terminalView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function getSingleTabLabel(instance: ITerminalInstance | null) {
return '';
}
const primaryStatus = instance.statusList.primary;
const baseLabel = `$(${instance.icon.id}) ${instance.title}`;
const baseLabel = `$(${instance.icon?.id}) ${instance.title}`;
if (primaryStatus?.icon) {
return `${baseLabel} $(${primaryStatus.icon.id})`;
}
Expand Down

0 comments on commit a0804b6

Please sign in to comment.