From 0c7223c4755e4b5bb7cd68b4aec3a5ae24f7271b Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Tue, 15 Jun 2021 07:31:23 -0500 Subject: [PATCH] finalize terminal iconPath (#125783) --- src/vs/vscode.d.ts | 10 +++++++ src/vs/vscode.proposed.d.ts | 28 +++++++++++-------- .../workbench/api/common/extHost.api.impl.ts | 3 -- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 4cfdafa54c9e9..172d1532c67c9 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -9441,6 +9441,11 @@ declare module 'vscode' { * a setting text style. */ message?: string; + + /** + * The icon path or {@link ThemeIcon} for the terminal. + */ + iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; } /** @@ -9457,6 +9462,11 @@ declare module 'vscode' { * control a terminal. */ pty: Pseudoterminal; + + /** + * The icon path or {@link ThemeIcon} for the terminal. + */ + iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index b9c560e104830..e99a1dc0d7b1f 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -874,20 +874,26 @@ declare module 'vscode' { //#endregion - //#region Terminal icon https://github.com/microsoft/vscode/issues/120538 + //#region Terminal name change event https://github.com/microsoft/vscode/issues/114898 - export interface TerminalOptions { + export interface Pseudoterminal { /** - * The icon path or {@link ThemeIcon} for the terminal. - */ - readonly iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; - } - - export interface ExtensionTerminalOptions { - /** - * A themeIcon, Uri, or light and dark Uris to use as the terminal tab icon + * An event that when fired allows changing the name of the terminal. + * + * **Example:** Change the terminal name to "My new terminal". + * ```typescript + * const writeEmitter = new vscode.EventEmitter(); + * const changeNameEmitter = new vscode.EventEmitter(); + * const pty: vscode.Pseudoterminal = { + * onDidWrite: writeEmitter.event, + * onDidChangeName: changeNameEmitter.event, + * open: () => changeNameEmitter.fire('My new terminal'), + * close: () => {} + * }; + * vscode.window.createTerminal({ name: 'My terminal', pty }); + * ``` */ - readonly iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; + onDidChangeName?: Event; } //#endregion diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index fbda991c0b81a..d26b8fa2b1c23 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -664,9 +664,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I if ('pty' in nameOrOptions) { return extHostTerminalService.createExtensionTerminal(nameOrOptions); } - if (nameOrOptions.iconPath) { - checkProposedApiEnabled(extension); - } return extHostTerminalService.createTerminalFromOptions(nameOrOptions); } return extHostTerminalService.createTerminal(nameOrOptions, shellPath, shellArgs);