From a91854820a6b02c376e99dd9156f9d37ca4c07ae Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 30 Aug 2024 12:19:42 -0700 Subject: [PATCH] Move shell integration scripts into common Fixes #225665 --- build/gulpfile.reh.js | 10 ---------- build/gulpfile.vscode.js | 20 +++++++++---------- src/vs/code/node/cli.ts | 2 +- .../terminal/node/terminalEnvironment.ts | 10 +++++----- .../test/node/terminalEnvironment.test.ts | 16 +++++++-------- .../scripts}/CodeTabExpansion.psm1 | 0 .../scripts}/GitTabExpansion.psm1 | 0 .../media => common/scripts}/cgmanifest.json | 0 .../fish/vendor_conf.d/shellIntegration.fish | 0 .../scripts}/shellIntegration-bash.sh | 0 .../scripts}/shellIntegration-env.zsh | 0 .../scripts}/shellIntegration-login.zsh | 0 .../scripts}/shellIntegration-profile.zsh | 0 .../scripts}/shellIntegration-rc.zsh | 0 .../scripts}/shellIntegration.ps1 | 0 15 files changed, 24 insertions(+), 34 deletions(-) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/CodeTabExpansion.psm1 (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/GitTabExpansion.psm1 (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/cgmanifest.json (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration-bash.sh (100%) mode change 100755 => 100644 rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration-env.zsh (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration-login.zsh (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration-profile.zsh (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration-rc.zsh (100%) rename src/vs/workbench/contrib/terminal/{browser/media => common/scripts}/shellIntegration.ps1 (100%) diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index 409d89ed8d9..61b26290bb7 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -64,16 +64,6 @@ const serverResourceIncludes = [ 'out-build/vs/base/node/cpuUsage.sh', 'out-build/vs/base/node/ps.sh', - // Terminal shell integration - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1', - 'out-build/vs/workbench/contrib/terminal/browser/media/CodeTabExpansion.psm1', - 'out-build/vs/workbench/contrib/terminal/browser/media/GitTabExpansion.psm1', - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh', - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh', - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh', - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh', - 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-login.zsh', - 'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish', ]; const serverResourceExcludes = [ diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 0e55b86ab99..049b25f2be8 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -85,11 +85,11 @@ const vscodeResourceIncludes = !isAMD() ? [ 'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt', // Terminal shell integration - 'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/*.fish', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.ps1', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.psm1', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.sh', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.zsh', + 'out-build/vs/workbench/contrib/terminal/common/scripts/fish_xdg_data/fish/vendor_conf.d/*.fish', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.ps1', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.psm1', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.sh', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.zsh', // Accessibility Signals 'out-build/vs/platform/accessibilitySignal/browser/media/*.mp3', @@ -130,11 +130,11 @@ const vscodeResourceIncludes = !isAMD() ? [ 'out-build/vs/workbench/browser/media/*-theme.css', 'out-build/vs/workbench/contrib/debug/**/*.json', 'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt', - 'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/*.fish', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.ps1', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.psm1', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.sh', - 'out-build/vs/workbench/contrib/terminal/browser/media/*.zsh', + 'out-build/vs/workbench/contrib/terminal/common/scripts/fish_xdg_data/fish/vendor_conf.d/*.fish', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.ps1', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.psm1', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.sh', + 'out-build/vs/workbench/contrib/terminal/common/scripts/*.zsh', 'out-build/vs/workbench/contrib/webview/browser/pre/*.js', '!out-build/vs/workbench/contrib/issue/**/*-dev.html', '!out-build/vs/workbench/contrib/issue/**/*-dev.esm.html', diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index e96d20f6796..ffd48670edc 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -112,7 +112,7 @@ export async function main(argv: string[]): Promise { case 'fish': file = 'fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish'; break; default: throw new Error('Error using --locate-shell-integration-path: Invalid shell type'); } - console.log(join(getAppRoot(), 'out', 'vs', 'workbench', 'contrib', 'terminal', 'browser', 'media', file)); + console.log(join(getAppRoot(), 'out', 'vs', 'workbench', 'contrib', 'terminal', 'common', 'scripts', file)); } // Extensions Management diff --git a/src/vs/platform/terminal/node/terminalEnvironment.ts b/src/vs/platform/terminal/node/terminalEnvironment.ts index b312dd5832e..d06bbe2acbc 100644 --- a/src/vs/platform/terminal/node/terminalEnvironment.ts +++ b/src/vs/platform/terminal/node/terminalEnvironment.ts @@ -321,13 +321,13 @@ enum ShellIntegrationExecutable { const shellIntegrationArgs: Map = new Map(); // The try catch swallows execution policy errors in the case of the archive distributable -shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']); -shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']); -shellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ['-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"{1}']); -shellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ['-l', '-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"']); +shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1\" } catch {}{1}']); +shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1\" } catch {}{1}']); +shellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ['-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"{1}']); +shellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ['-l', '-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"']); shellIntegrationArgs.set(ShellIntegrationExecutable.Zsh, ['-i']); shellIntegrationArgs.set(ShellIntegrationExecutable.ZshLogin, ['-il']); -shellIntegrationArgs.set(ShellIntegrationExecutable.Bash, ['--init-file', '{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh']); +shellIntegrationArgs.set(ShellIntegrationExecutable.Bash, ['--init-file', '{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh']); const pwshLoginArgs = ['-login', '-l']; const shLoginArgs = ['--login', '-l']; const shInteractiveArgs = ['-i', '--interactive']; diff --git a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts index 9c48f656bfa..6248f83003d 100644 --- a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts +++ b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts @@ -47,8 +47,8 @@ suite('platform - terminalEnvironment', () => { // These tests are only expected to work on Windows 10 build 18309 and above (getWindowsBuildNumber() < 18309 ? suite.skip : suite)('pwsh', () => { const expectedPs1 = process.platform === 'win32' - ? `try { . "${repoRoot}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1" } catch {}` - : `. "${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"`; + ? `try { . "${repoRoot}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}` + : `. "${repoRoot}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"`; suite('should override args', () => { const enabledExpectedResult = Object.freeze({ newArgs: [ @@ -126,10 +126,10 @@ suite('platform - terminalEnvironment', () => { new RegExp(`.+\\/${username}-vscode-zsh\\/\\.zlogin`) ]; const expectedSources = [ - /.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-rc.zsh/, - /.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-profile.zsh/, - /.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-env.zsh/, - /.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-login.zsh/ + /.+\/out\/vs\/workbench\/contrib\/terminal\/common\/scripts\/shellIntegration-rc.zsh/, + /.+\/out\/vs\/workbench\/contrib\/terminal\/common\/scripts\/shellIntegration-profile.zsh/, + /.+\/out\/vs\/workbench\/contrib\/terminal\/common\/scripts\/shellIntegration-env.zsh/, + /.+\/out\/vs\/workbench\/contrib\/terminal\/common\/scripts\/shellIntegration-login.zsh/ ]; function assertIsEnabled(result: IShellIntegrationConfigInjection, globalZdotdir = homedir()) { strictEqual(Object.keys(result.envMixin!).length, 3); @@ -190,7 +190,7 @@ suite('platform - terminalEnvironment', () => { const enabledExpectedResult = Object.freeze({ newArgs: [ '--init-file', - `${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh` + `${repoRoot}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh` ], envMixin: { VSCODE_INJECTION: '1' @@ -204,7 +204,7 @@ suite('platform - terminalEnvironment', () => { const enabledExpectedResult = Object.freeze({ newArgs: [ '--init-file', - `${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh` + `${repoRoot}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh` ], envMixin: { VSCODE_INJECTION: '1', diff --git a/src/vs/workbench/contrib/terminal/browser/media/CodeTabExpansion.psm1 b/src/vs/workbench/contrib/terminal/common/scripts/CodeTabExpansion.psm1 similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/CodeTabExpansion.psm1 rename to src/vs/workbench/contrib/terminal/common/scripts/CodeTabExpansion.psm1 diff --git a/src/vs/workbench/contrib/terminal/browser/media/GitTabExpansion.psm1 b/src/vs/workbench/contrib/terminal/common/scripts/GitTabExpansion.psm1 similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/GitTabExpansion.psm1 rename to src/vs/workbench/contrib/terminal/common/scripts/GitTabExpansion.psm1 diff --git a/src/vs/workbench/contrib/terminal/browser/media/cgmanifest.json b/src/vs/workbench/contrib/terminal/common/scripts/cgmanifest.json similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/cgmanifest.json rename to src/vs/workbench/contrib/terminal/common/scripts/cgmanifest.json diff --git a/src/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish b/src/vs/workbench/contrib/terminal/common/scripts/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish rename to src/vs/workbench/contrib/terminal/common/scripts/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh old mode 100755 new mode 100644 similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-login.zsh b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration-login.zsh rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1 similarity index 100% rename from src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 rename to src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1