@@ -10,7 +10,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
1010import * as platform from 'vs/base/common/platform' ;
1111import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment' ;
1212import { Event , Emitter } from 'vs/base/common/event' ;
13- import { ExtHostTerminalServiceShape , MainContext , MainThreadTerminalServiceShape , IMainContext , ShellLaunchConfigDto , IShellDefinitionDto } from 'vs/workbench/api/common/extHost.protocol' ;
13+ import { ExtHostTerminalServiceShape , MainContext , MainThreadTerminalServiceShape , IMainContext , ShellLaunchConfigDto , IShellDefinitionDto , IShellAndArgsDto } from 'vs/workbench/api/common/extHost.protocol' ;
1414import { ExtHostConfiguration , ExtHostConfigProvider } from 'vs/workbench/api/common/extHostConfiguration' ;
1515import { ILogService } from 'vs/platform/log/common/log' ;
1616import { EXT_HOST_CREATION_DELAY , IShellLaunchConfig , ITerminalEnvironment } from 'vs/workbench/contrib/terminal/common/terminal' ;
@@ -20,7 +20,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
2020import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace' ;
2121import { ExtHostVariableResolverService } from 'vs/workbench/api/node/extHostDebugService' ;
2222import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors' ;
23- import { getDefaultShell , detectAvailableShells } from 'vs/workbench/contrib/terminal/node/terminal' ;
23+ import { getSystemShell , detectAvailableShells } from 'vs/workbench/contrib/terminal/node/terminal' ;
2424
2525const RENDERER_NO_PROCESS_ID = - 1 ;
2626
@@ -338,12 +338,22 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
338338 return terminalEnvironment . getDefaultShell (
339339 fetchSetting ,
340340 this . _isWorkspaceShellAllowed ,
341- getDefaultShell ( platform . platform ) ,
341+ getSystemShell ( platform . platform ) ,
342342 process . env . hasOwnProperty ( 'PROCESSOR_ARCHITEW6432' ) ,
343343 process . env . windir
344344 ) ;
345345 }
346346
347+ private _getDefaultShellArgs ( configProvider : ExtHostConfigProvider ) : string [ ] | string | undefined {
348+ const fetchSetting = ( key : string ) => {
349+ const setting = configProvider
350+ . getConfiguration ( key . substr ( 0 , key . lastIndexOf ( '.' ) ) )
351+ . inspect < string | string [ ] > ( key . substr ( key . lastIndexOf ( '.' ) + 1 ) ) ;
352+ return this . _apiInspectConfigToPlain < string | string [ ] > ( setting ) ;
353+ } ;
354+ return terminalEnvironment . getDefaultShellArgs ( fetchSetting , this . _isWorkspaceShellAllowed ) ;
355+ }
356+
347357 public async resolveTerminalRenderer ( id : number ) : Promise < vscode . TerminalRenderer > {
348358 // Check to see if the extension host already knows about this terminal.
349359 for ( const terminalRenderer of this . _terminalRenderers ) {
@@ -495,7 +505,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
495505 shellLaunchConfig ,
496506 fetchSetting ,
497507 isWorkspaceShellAllowed || false ,
498- getDefaultShell ( platform . platform ) ,
508+ getSystemShell ( platform . platform ) ,
499509 process . env . hasOwnProperty ( 'PROCESSOR_ARCHITEW6432' ) ,
500510 process . env . windir
501511 ) ;
@@ -579,8 +589,17 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
579589 return detectAvailableShells ( ) ;
580590 }
581591
592+ // TODO: Remove this once requestDefaultShellAndArgs is working
582593 public $requestDefaultShell ( ) : Promise < string > {
583- return Promise . resolve ( getDefaultShell ( platform . platform ) ) ;
594+ return Promise . resolve ( getSystemShell ( platform . platform ) ) ;
595+ }
596+
597+ public async $requestDefaultShellAndArgs ( ) : Promise < IShellAndArgsDto > {
598+ const configProvider = await this . _extHostConfiguration . getConfigProvider ( ) ;
599+ return Promise . resolve ( {
600+ shell : this . getDefaultShell ( configProvider ) ,
601+ args : this . _getDefaultShellArgs ( configProvider )
602+ } ) ;
584603 }
585604
586605 private _onProcessExit ( id : number , exitCode : number ) : void {
0 commit comments