From 3901947550ba5d666727c8b0239d19065cc1f103 Mon Sep 17 00:00:00 2001 From: Owen Campbell Date: Wed, 28 Nov 2018 13:57:35 +0000 Subject: [PATCH 1/5] Add xonsh shell --- .../terminal/environmentActivationProviders/bash.ts | 10 ++++++++-- src/client/common/terminal/types.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/common/terminal/environmentActivationProviders/bash.ts b/src/client/common/terminal/environmentActivationProviders/bash.ts index d330ec60d690..a3afc8ae0c76 100644 --- a/src/client/common/terminal/environmentActivationProviders/bash.ts +++ b/src/client/common/terminal/environmentActivationProviders/bash.ts @@ -20,14 +20,20 @@ export class Bash extends BaseActivationCommandProvider { targetShell === TerminalShellType.zsh || targetShell === TerminalShellType.cshell || targetShell === TerminalShellType.tcshell || - targetShell === TerminalShellType.fish; + targetShell === TerminalShellType.fish || + targetShell === TerminalShellType.xonsh; } public async getActivationCommandsForInterpreter(pythonPath: string, targetShell: TerminalShellType): Promise { const scriptFile = await this.findScriptFile(pythonPath, this.getScriptsInOrderOfPreference(targetShell)); if (!scriptFile) { return; } - return [`source ${scriptFile.fileToCommandArgument()}`]; + + if (targetShell === TerminalShellType.xonsh) { + return [`conda ${scriptFile.fileToCommandArgument()}`]; + } else { + return [`source ${scriptFile.fileToCommandArgument()}`]; + } } private getScriptsInOrderOfPreference(targetShell: TerminalShellType): string[] { diff --git a/src/client/common/terminal/types.ts b/src/client/common/terminal/types.ts index aebf8758b7fc..a58a9b81921b 100644 --- a/src/client/common/terminal/types.ts +++ b/src/client/common/terminal/types.ts @@ -16,6 +16,7 @@ export enum TerminalShellType { cshell = 'cshell', tcshell = 'tshell', wsl = 'wsl', + xonsh = 'xonsh', other = 'other' } From d5d1f15e8c7ac9fef150871966e9a6a077b4eb91 Mon Sep 17 00:00:00 2001 From: Owen Campbell Date: Wed, 28 Nov 2018 14:06:42 +0000 Subject: [PATCH 2/5] Add news file --- news/1 Enhancements/3487.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/1 Enhancements/3487.md diff --git a/news/1 Enhancements/3487.md b/news/1 Enhancements/3487.md new file mode 100644 index 000000000000..7971942b2b3e --- /dev/null +++ b/news/1 Enhancements/3487.md @@ -0,0 +1 @@ +Add support for the Xonsh shell From afc4f948aafc95b27e14045487d1ae15c56540a9 Mon Sep 17 00:00:00 2001 From: Owen Campbell Date: Wed, 19 Dec 2018 11:10:10 +0000 Subject: [PATCH 3/5] Add xonsh to detectable shells --- src/client/common/terminal/helper.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/common/terminal/helper.ts b/src/client/common/terminal/helper.ts index 41708be66388..ac2080e4de96 100644 --- a/src/client/common/terminal/helper.ts +++ b/src/client/common/terminal/helper.ts @@ -25,6 +25,7 @@ const IS_POWERSHELL_CORE = /(pwsh.exe$|pwsh$)/i; const IS_FISH = /(fish$)/i; const IS_CSHELL = /(csh$)/i; const IS_TCSHELL = /(tcsh$)/i; +const IS_XONSH = /(xonsh$)/i; @injectable() export class TerminalHelper implements ITerminalHelper { @@ -42,6 +43,7 @@ export class TerminalHelper implements ITerminalHelper { this.detectableShells.set(TerminalShellType.tcshell, IS_TCSHELL); this.detectableShells.set(TerminalShellType.cshell, IS_CSHELL); this.detectableShells.set(TerminalShellType.powershellCore, IS_POWERSHELL_CORE); + this.detectableShells.set(TerminalShellType.xonsh, IS_XONSH); } public createTerminal(title?: string): Terminal { const terminalManager = this.serviceContainer.get(ITerminalManager); From 3e0b7e07d76ea02d0d7375f8aac0c52dd5efe12a Mon Sep 17 00:00:00 2001 From: Owen Campbell Date: Wed, 19 Dec 2018 13:27:35 +0000 Subject: [PATCH 4/5] Add xonsh to terminal tests --- src/test/common/terminals/activation.bash.unit.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/common/terminals/activation.bash.unit.test.ts b/src/test/common/terminals/activation.bash.unit.test.ts index 0fafb57a0277..9417bcd4de70 100644 --- a/src/test/common/terminals/activation.bash.unit.test.ts +++ b/src/test/common/terminals/activation.bash.unit.test.ts @@ -73,6 +73,7 @@ suite('Terminal Environment Activation (bash)', () => { case TerminalShellType.gitbash: case TerminalShellType.tcshell: case TerminalShellType.cshell: + case TerminalShellType.xonsh: case TerminalShellType.fish: { expect(supported).to.be.equal(true, `${shellType.name} shell not supported (it should be)`); break; From 75a92811df77b3c1d42c72edeeaf0f7cc585ddc4 Mon Sep 17 00:00:00 2001 From: Owen Campbell Date: Wed, 19 Dec 2018 13:42:46 +0000 Subject: [PATCH 5/5] Add xonsh to test plan --- .github/test_plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/test_plan.md b/.github/test_plan.md index 98436a408791..728e43069979 100644 --- a/.github/test_plan.md +++ b/.github/test_plan.md @@ -3,7 +3,7 @@ ## Environment - OS: XXX (Windows, macOS, latest Ubuntu LTS) - - Shell: XXX (Command Prompt, PowerShell, bash, fish) + - Shell: XXX (Command Prompt, PowerShell, bash, fish, xonsh) - Python - Distribution: XXX (CPython, miniconda) - Version: XXX (2.7, latest 3.x)