Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finalize terminal iconPath #125783

Merged
merged 5 commits into from Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/vs/vscode.d.ts
Expand Up @@ -9385,6 +9385,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 @@ -9401,6 +9406,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
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
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