Fix PSReadline for screen reader (#298881)

* Fix PSReadline for screen reader, disable header

* Add psreadline to index.ts for build

* organize much better

* compile

* list out exact folder

* try if codesign is the problem

* Update comment to be more accurate

* Undo changes for noLogo
This commit is contained in:
Anthony Kim
2026-03-10 19:35:11 -07:00
committed by GitHub
parent b6813ea6be
commit a0d3bb68f2
6 changed files with 36 additions and 6 deletions

View File

@@ -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;

View File

@@ -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/**',
];

View File

@@ -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',

View File

@@ -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)

View File

@@ -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 };

View File

@@ -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
}
}