diff --git a/build/azure-pipelines/win32/codesign.ts b/build/azure-pipelines/win32/codesign.ts index dce5e55b840..1d51cb08c62 100644 --- a/build/azure-pipelines/win32/codesign.ts +++ b/build/azure-pipelines/win32/codesign.ts @@ -19,7 +19,7 @@ async function main() { // 2. Codesign Powershell scripts // 3. Codesign context menu appx package (insiders only) const codesignTask1 = spawnCodesignProcess(esrpCliDLLPath, 'sign-windows', codeSigningFolderPath, '*.dll,*.exe,*.node'); - const codesignTask2 = spawnCodesignProcess(esrpCliDLLPath, 'sign-windows-appx', codeSigningFolderPath, '*.ps1'); + const codesignTask2 = spawnCodesignProcess(esrpCliDLLPath, 'sign-windows-appx', codeSigningFolderPath, '*.ps1,*.psm1,*.psd1,*.ps1xml'); const codesignTask3 = process.env['VSCODE_QUALITY'] !== 'exploration' ? spawnCodesignProcess(esrpCliDLLPath, 'sign-windows-appx', codeSigningFolderPath, '*.appx') : undefined; diff --git a/build/gulpfile.reh.ts b/build/gulpfile.reh.ts index 8e7f6bbbdca..0ad08ab6fbe 100644 --- a/build/gulpfile.reh.ts +++ b/build/gulpfile.reh.ts @@ -83,6 +83,7 @@ const serverResourceIncludes = [ 'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh', 'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh', 'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish', + 'out-build/vs/workbench/contrib/terminal/common/scripts/psreadline/**', ]; diff --git a/build/gulpfile.vscode.ts b/build/gulpfile.vscode.ts index 0912be85425..e33ae905ad1 100644 --- a/build/gulpfile.vscode.ts +++ b/build/gulpfile.vscode.ts @@ -91,6 +91,7 @@ const vscodeResourceIncludes = [ '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/terminal/common/scripts/psreadline/**', // Accessibility Signals 'out-build/vs/platform/accessibilitySignal/browser/media/*.mp3', diff --git a/build/next/index.ts b/build/next/index.ts index a77b98b5c63..a5bb0796da0 100644 --- a/build/next/index.ts +++ b/build/next/index.ts @@ -260,6 +260,12 @@ const desktopResourcePatterns = [ 'vs/workbench/contrib/terminal/common/scripts/*.psm1', 'vs/workbench/contrib/terminal/common/scripts/*.fish', 'vs/workbench/contrib/terminal/common/scripts/*.zsh', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.psd1', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.psm1', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.dll', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.ps1xml', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/net6plus/*.dll', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/netstd/*.dll', 'vs/workbench/contrib/externalTerminal/**/*.scpt', // Media - audio @@ -297,6 +303,12 @@ const serverResourcePatterns = [ 'vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh', 'vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh', 'vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.psd1', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.psm1', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.dll', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/*.ps1xml', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/net6plus/*.dll', + 'vs/workbench/contrib/terminal/common/scripts/psreadline/netstd/*.dll', ]; // Resources for server-web target (server + web UI) diff --git a/src/vs/platform/terminal/node/terminalEnvironment.ts b/src/vs/platform/terminal/node/terminalEnvironment.ts index 5aa0a0dd13a..178bed35e83 100644 --- a/src/vs/platform/terminal/node/terminalEnvironment.ts +++ b/src/vs/platform/terminal/node/terminalEnvironment.ts @@ -118,6 +118,7 @@ export async function getShellIntegrationInjection( if (!newArgs) { return { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs }; } + newArgs = [...newArgs]; newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot, ''); envMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0'; return { type, newArgs, envMixin }; diff --git a/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1 b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1 index a16eaa85342..60115ec9943 100644 --- a/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1 +++ b/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1 @@ -176,13 +176,28 @@ elseif ((Test-Path variable:global:GitPromptSettings) -and $Global:GitPromptSett } if ($Global:__VSCodeState.IsA11yMode -eq "1") { - if (-not (Get-Module -Name PSReadLine)) { - $scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path - $specialPsrlPath = Join-Path $scriptRoot 'psreadline' - Import-Module $specialPsrlPath + # Check if the loaded PSReadLine already supports EnableScreenReaderMode + $hasScreenReaderParam = (Get-Module -Name PSReadLine) -and (Get-Command Set-PSReadLineOption).Parameters.ContainsKey('EnableScreenReaderMode') + + if (-not $hasScreenReaderParam) { + # The loaded PSReadLine lacks EnableScreenReaderMode (only available in 2.4.3+). + # On PS 7.5+ the module may already be removed by PS's own screen reader detection, + # on PS 7.0-7.4 it's still loaded and must be removed to load our bundled copy. if (Get-Module -Name PSReadLine) { - Set-PSReadLineOption -EnableScreenReaderMode + Remove-Module PSReadLine -Force } + + # Import VS Code's bundled PSReadLine 2.4.3 which has EnableScreenReaderMode + $specialPsrlPath = Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) 'psreadline' + if (Test-Path $specialPsrlPath) { + Import-Module $specialPsrlPath + } + + $hasScreenReaderParam = (Get-Module -Name PSReadLine) -and (Get-Command Set-PSReadLineOption).Parameters.ContainsKey('EnableScreenReaderMode') + } + + if ($hasScreenReaderParam) { + Set-PSReadLineOption -EnableScreenReaderMode } }