diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index 8c34992d106..ff9365a3709 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -780,7 +780,7 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { } public $getAvailableProfiles(quickLaunchOnly: boolean): Promise { - throw new NotSupportedError(); + return new Promise(() => []); } public async $getDefaultShellAndArgs(useAutomationShell: boolean): Promise { diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index 66f6022e5a9..17d4f9e72d5 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -233,8 +233,8 @@ export interface ITerminalProfile { } export const enum ProfileSource { - 'Git Bash', - 'PowerShell' + gitbash = 'Git Bash', + pwsh = 'PowerShell' } export interface ITerminalExecutable { diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 6e13c4950f5..9128c0f8411 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -95,7 +95,7 @@ export const terminalConfiguration: IConfigurationNode = { source: 'Git Bash' }, 'Command Prompt': { - path: + pathOrPaths: [ '${env:windir}\\Sysnative\\cmd.exe', '${env:windir}\\System32\\cmd.exe' @@ -104,7 +104,7 @@ export const terminalConfiguration: IConfigurationNode = { }, 'Windows PowerShell': { comment: 'note that this will not be included in the quickSelect drop down if another version of powershell is installed', - path: + pathOrPaths: [ '${env:windir}\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe', '${env:windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe' diff --git a/src/vs/workbench/contrib/terminal/test/node/terminalProfiles.test.ts b/src/vs/workbench/contrib/terminal/test/node/terminalProfiles.test.ts index 575f90e6ca7..6930039d9b0 100644 --- a/src/vs/workbench/contrib/terminal/test/node/terminalProfiles.test.ts +++ b/src/vs/workbench/contrib/terminal/test/node/terminalProfiles.test.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// import * as assert from 'assert'; +import * as assert from 'assert'; import { isWindows } from 'vs/base/common/platform'; -import { ITerminalProfiles } from 'vs/workbench/contrib/terminal/common/terminal'; -// import { detectAvailableProfiles, IStatProvider } from 'vs/workbench/contrib/terminal/node/terminalProfiles'; +import { ITerminalProfiles, ProfileSource } from 'vs/workbench/contrib/terminal/common/terminal'; +import { detectAvailableProfiles, IStatProvider } from 'vs/workbench/contrib/terminal/node/terminalProfiles'; export interface ITestTerminalConfig { profiles: ITerminalProfiles; @@ -17,50 +17,50 @@ suite('Workbench - TerminalProfiles', () => { suite('detectAvailableProfiles', () => { if (isWindows) { suite('detectAvailableWindowsProfiles', async () => { - // test('should detect cmd prompt', async () => { - // const _paths = ['C:\\WINDOWS\\System32\\cmd.exe']; - // let config: ITestTerminalConfig = { - // profiles: { - // windows: { - // 'Command Prompt': { path: _paths } - // } - // }, - // detectWslProfiles: false - // }; - // const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths)); - // const expected = [{ profileName: 'Command Prompt', path: _paths[0] }]; - // assert.deepStrictEqual(expected, profiles); - // }); + test('should detect cmd prompt', async () => { + const _paths = ['C:\\WINDOWS\\System32\\cmd.exe']; + let config: ITestTerminalConfig = { + profiles: { + windows: { + 'Command Prompt': { pathOrPaths: _paths } + }, + linux: {}, + osx: {}, + }, + detectWslProfiles: false + }; + const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths)); + const expected = [{ profileName: 'Command Prompt', path: _paths[0] }]; + assert.deepStrictEqual(expected, profiles); + }); test('should detect Git Bash and provide login args', async () => { - // const _paths = [`C:\\Program Files\\Git\\bin\\bash.exe`]; - // let config: ITestTerminalConfig = { - // profiles: { - // windows: { - // 'Git Bash': { - // source: ProfileSource['Git Bash'] - // }, - // }, - // linux: {}, - // osx: {} - // }, - // detectWslProfiles: false - // }; - // const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths)); - // const expected = [{ profileName: 'Git Bash', path: _paths[0], args: ['--login'] }]; - // assert.deepStrictEqual(profiles, expected); + const _paths = [`C:\\Program Files\\Git\\bin\\bash.exe`]; + let config: ITestTerminalConfig = { + profiles: { + windows: { + 'Git Bash': { source: ProfileSource.gitbash } + }, + linux: {}, + osx: {} + }, + detectWslProfiles: false + }; + const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths)); + const expected = [{ profileName: 'Git Bash', path: _paths[0], args: ['--login'] }]; + assert.deepStrictEqual(profiles, expected); }); }); } }); }); -// function createStatProvider(expectedPaths: string[]): IStatProvider { -// const provider = { -// stat(path: string) { -// return expectedPaths.includes(path); -// }, -// lstat(path: string) { -// return expectedPaths.includes(path); -// } -// }; -// return provider; -// } +function createStatProvider(expectedPaths: string[]): IStatProvider { + const provider = { + stat(path: string) { + return expectedPaths.includes(path); + }, + lstat(path: string) { + return expectedPaths.includes(path); + } + }; + return provider; +}