Skip to content

Commit

Permalink
finalize terminal iconPath (#125783)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Jun 15, 2021
1 parent fe8bb48 commit 0c7223c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
10 changes: 10 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand Down
28 changes: 17 additions & 11 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
* const changeNameEmitter = new vscode.EventEmitter<string>();
* 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<string>;
}

//#endregion
Expand Down
3 changes: 0 additions & 3 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0c7223c

Please sign in to comment.