Merge pull request #160900 from babakks/add-change-shell-event

Add `onDidChangeShell` event to the API
This commit is contained in:
Daniel Imms
2022-09-14 07:53:50 -07:00
committed by GitHub
5 changed files with 29 additions and 0 deletions
+1
View File
@@ -36,6 +36,7 @@
"taskPresentationGroup",
"terminalDataWriteEvent",
"terminalDimensions",
"envShellEvent",
"testCoverage",
"testObserver",
"textSearchProvider",
@@ -309,6 +309,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get shell() {
return extHostTerminalService.getDefaultShell(false);
},
get onDidChangeShell() {
checkProposedApiEnabled(extension, 'envShellEvent');
return extHostTerminalService.onDidChangeShell;
},
get isTelemetryEnabled() {
return extHostTelemetry.getTelemetryConfiguration();
},
@@ -39,6 +39,7 @@ export interface IExtHostTerminalService extends ExtHostTerminalServiceShape, ID
onDidChangeTerminalDimensions: Event<vscode.TerminalDimensionsChangeEvent>;
onDidChangeTerminalState: Event<vscode.Terminal>;
onDidWriteTerminalData: Event<vscode.TerminalDataWriteEvent>;
onDidChangeShell: Event<string>;
createTerminal(name?: string, shellPath?: string, shellArgs?: readonly string[] | string): vscode.Terminal;
createTerminalFromOptions(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal;
@@ -378,6 +379,8 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
readonly onDidChangeTerminalState = this._onDidChangeTerminalState.event;
protected readonly _onDidWriteTerminalData: Emitter<vscode.TerminalDataWriteEvent>;
get onDidWriteTerminalData(): Event<vscode.TerminalDataWriteEvent> { return this._onDidWriteTerminalData.event; }
protected readonly _onDidChangeShell = new Emitter<string>();
readonly onDidChangeShell = this._onDidChangeShell.event;
constructor(
supportsProcesses: boolean,
@@ -811,8 +814,12 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
}
public $acceptDefaultProfile(profile: ITerminalProfile, automationProfile: ITerminalProfile): void {
const oldProfile = this._defaultProfile;
this._defaultProfile = profile;
this._defaultAutomationProfile = automationProfile;
if (oldProfile?.path !== profile.path) {
this._onDidChangeShell.fire(profile.path);
}
}
private _setEnvironmentVariableCollection(extensionIdentifier: string, collection: EnvironmentVariableCollection): void {
@@ -25,6 +25,7 @@ export const allApiProposals = Object.freeze({
documentPaste: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentPaste.d.ts',
editSessionIdentityProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts',
editorInsets: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts',
envShellEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envShellEvent.d.ts',
extensionRuntime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts',
extensionsAny: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts',
externalUriOpener: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts',
+16
View File
@@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// See https://github.com/microsoft/vscode/issues/160694
export namespace env {
/**
* An {@link Event} which fires when the default shell changes.
*/
export const onDidChangeShell: Event<string>;
}
}