From a62805844ef4b2c0bf22b069bcf136ac064feded Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 13 Jan 2020 07:45:08 -0800 Subject: [PATCH] Expose IExtHostTerminalService.getDefaultShellArgs internally Fixes #88280 --- src/vs/workbench/api/common/extHostTerminalService.ts | 6 ++++++ src/vs/workbench/api/node/extHostTerminalService.ts | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index f5635b83d23..6314faeadf4 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -32,6 +32,7 @@ export interface IExtHostTerminalService extends ExtHostTerminalServiceShape { createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal; attachPtyToTerminal(id: number, pty: vscode.Pseudoterminal): void; getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string; + getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string; } export const IExtHostTerminalService = createDecorator('IExtHostTerminalService'); @@ -321,6 +322,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ public abstract createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal; public abstract createTerminalFromOptions(options: vscode.TerminalOptions): vscode.Terminal; public abstract getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string; + public abstract getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string; public abstract $spawnExtHostProcess(id: number, shellLaunchConfigDto: IShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise; public abstract $requestAvailableShells(): Promise; public abstract $requestDefaultShellAndArgs(useAutomationShell: boolean): Promise; @@ -595,6 +597,10 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { throw new Error('Not implemented'); } + public getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string { + throw new Error('Not implemented'); + } + public $spawnExtHostProcess(id: number, shellLaunchConfigDto: IShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise { throw new Error('Not implemented'); } diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index 8d2f73a9263..1eda3462786 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -78,7 +78,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { ); } - private _getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string { + public getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string { const fetchSetting = (key: string): { userValue: string | string[] | undefined, value: string | string[] | undefined, defaultValue: string | string[] | undefined } => { const setting = configProvider .getConfiguration(key.substr(0, key.lastIndexOf('.'))) @@ -137,7 +137,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { const configProvider = await this._extHostConfiguration.getConfigProvider(); if (!shellLaunchConfig.executable) { shellLaunchConfig.executable = this.getDefaultShell(false, configProvider); - shellLaunchConfig.args = this._getDefaultShellArgs(false, configProvider); + shellLaunchConfig.args = this.getDefaultShellArgs(false, configProvider); } else { if (this._variableResolver) { shellLaunchConfig.executable = this._variableResolver.resolve(this._lastActiveWorkspace, shellLaunchConfig.executable); @@ -208,7 +208,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { const configProvider = await this._extHostConfiguration.getConfigProvider(); return Promise.resolve({ shell: this.getDefaultShell(useAutomationShell, configProvider), - args: this._getDefaultShellArgs(useAutomationShell, configProvider) + args: this.getDefaultShellArgs(useAutomationShell, configProvider) }); }