diff --git a/src/vs/platform/terminal/common/terminal.ts b/src/vs/platform/terminal/common/terminal.ts index 402d32d054eb89..2c64f51f213ee4 100644 --- a/src/vs/platform/terminal/common/terminal.ts +++ b/src/vs/platform/terminal/common/terminal.ts @@ -281,6 +281,12 @@ export interface IShellLaunchConfig { * Whether this terminal was created by an extension. */ isExtensionOwnedTerminal?: boolean; + + /** + * The codicon ID to use for this terminal. If not specified it will use the default fallback + * icon. + */ + iconId?: string; } export interface IShellLaunchConfigDto { diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index ee16f2378ff705..9cefdcd1d4200d 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { Codicon } from 'vs/base/common/codicons'; import { Event } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; import { IProcessEnvironment, Platform } from 'vs/base/common/platform'; @@ -244,6 +245,7 @@ export interface ITerminalInstance { readonly rows: number; readonly maxCols: number; readonly maxRows: number; + readonly icon: Codicon; /** * The process ID of the shell process, this is undefined when there is no process associated diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 9edcb33288f18f..48ef525d2fc7c2 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -1517,7 +1517,13 @@ export function registerTerminalActions() { if (launchConfig) { const workspaceShellAllowed = terminalService.configHelper.checkIsProcessLaunchSafe(undefined, launchConfig); if (workspaceShellAllowed) { - const instance = terminalService.createTerminal({ executable: launchConfig.path, args: launchConfig.args, name: launchConfig.overrideName ? launchConfig.profileName : undefined }); + // TODO: Share profile launch with that in terminalService + const instance = terminalService.createTerminal({ + executable: launchConfig.path, + args: launchConfig.args, + iconId: launchConfig.icon, + name: launchConfig.overrideName ? launchConfig.profileName : undefined + }); terminalService.setActiveInstance(instance); } } else { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index cd7c671dddb930..6caa23006b9f05 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -51,6 +51,7 @@ import { IProcessDataEvent, IShellLaunchConfig, ITerminalDimensionsOverride, ITe import { IProductService } from 'vs/platform/product/common/productService'; import { formatMessageForTerminal } from 'vs/workbench/contrib/terminal/common/terminalStrings'; import { AutoOpenBarrier } from 'vs/base/common/async'; +import { Codicon, iconRegistry } from 'vs/base/common/codicons'; // How long in milliseconds should an average frame take to render for a notification to appear // which suggests the fallback DOM-based renderer @@ -169,6 +170,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.shellLaunchConfig.iconId ? (iconRegistry.get(this.shellLaunchConfig.iconId) || Codicon.terminal) : Codicon.terminal; } private readonly _onExit = new Emitter(); public get onExit(): Event { return this._onExit.event; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index d19b6cb9b055b5..c7e209d31afdbc 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -895,7 +895,13 @@ export class TerminalService implements ITerminalService { return; } if (type === 'createInstance') { - const launchConfig = { executable: value.profile.path, args: value.profile.args, name: value.profile.overrideName ? value.profile.profileName : undefined }; + const launchConfig: IShellLaunchConfig = { + executable: value.profile.path, + args: value.profile.args, + iconId: value.profile.icon, + name: value.profile.overrideName ? value.profile.profileName : undefined + }; + let instance; const activeInstance = this.getActiveInstance(); if (keyMods?.alt && activeInstance) { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts index 95599ea105f5a5..fd075131154d16 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts @@ -414,7 +414,7 @@ export class TerminalTab extends Disposable implements ITerminalTab { } private _titleWithConnectionStatus(instance: ITerminalInstance): string { - return instance.isDisconnected ? localize('ptyDisconnected', "{0} (disconnected)", instance.title) : instance.title; + return instance.isDisconnected ? localize('ptyDisconnected', "{0} (disconnected)", instance.title) : `${instance.title} [${instance.icon.id}]`; } public setVisible(visible: boolean): void { diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index dd85328417a861..3bf48d66f71f8e 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -238,6 +238,7 @@ export interface ITerminalProfile { isWorkspaceProfile?: boolean; args?: string | string[] | undefined; overrideName?: boolean; + icon?: string; } export const enum ProfileSource {