@@ -12,6 +12,7 @@ import { DisposableStore, MutableDisposable } from '../../../../../base/common/l
1212import { OperatingSystem } from '../../../../../base/common/platform.js' ;
1313import { ThemeIcon } from '../../../../../base/common/themables.js' ;
1414import { hasKey , isNumber , isObject , isString } from '../../../../../base/common/types.js' ;
15+ import { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js' ;
1516import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js' ;
1617import { TerminalCapability } from '../../../../../platform/terminal/common/capabilities/capabilities.js' ;
1718import { PromptInputState } from '../../../../../platform/terminal/common/capabilities/commandDetection/promptInputModel.js' ;
@@ -48,6 +49,7 @@ export class ToolTerminalCreator {
4849 private static _lastSuccessfulShell : ShellLaunchType = ShellLaunchType . Unknown ;
4950
5051 constructor (
52+ @IAccessibilityService private readonly _accessibilityService : IAccessibilityService ,
5153 @IConfigurationService private readonly _configurationService : IConfigurationService ,
5254 @ITerminalLogService private readonly _logService : ITerminalLogService ,
5355 @ITerminalService private readonly _terminalService : ITerminalService ,
@@ -199,11 +201,22 @@ export class ToolTerminalCreator {
199201 const store = new DisposableStore ( ) ;
200202 const result = new DeferredPromise < ShellIntegrationQuality > ( ) ;
201203
204+ // When screen reader mode is on, allow extra time before giving up on shell integration.
205+ // Cold-loading PSReadLine on Windows PowerShell 5.1 with accessibility mode enabled can
206+ // push the `HasRichCommandDetection` sequence past the default window, which otherwise
207+ // causes `shellIntegrationQuality` to be stuck at `None` and the "Enable shell integration"
208+ // banner to show up incorrectly. Only extend non-zero timeouts so tests using 0 remain 0.
209+ const isScreenReaderOptimized = this . _accessibilityService . isScreenReaderOptimized ( ) ;
210+ const effectiveTimeoutMs = timeoutMs > 0 && isScreenReaderOptimized
211+ ? timeoutMs + 3000
212+ : timeoutMs ;
213+ this . _logService . info ( `ToolTerminalCreator#_waitForShellIntegration: base ${ timeoutMs } ms, effective ${ effectiveTimeoutMs } ms, screenReaderOptimized=${ isScreenReaderOptimized } ` ) ;
214+
202215 const siNoneTimer = store . add ( new MutableDisposable ( ) ) ;
203216 siNoneTimer . value = disposableTimeout ( ( ) => {
204- this . _logService . info ( `ToolTerminalCreator#_waitForShellIntegration: Timed out ${ timeoutMs } ms, using no SI` ) ;
217+ this . _logService . info ( `ToolTerminalCreator#_waitForShellIntegration: Timed out ${ effectiveTimeoutMs } ms, using no SI` ) ;
205218 result . complete ( ShellIntegrationQuality . None ) ;
206- } , timeoutMs ) ;
219+ } , effectiveTimeoutMs ) ;
207220
208221 if ( instance . capabilities . get ( TerminalCapability . CommandDetection ) ?. hasRichCommandDetection ) {
209222 // Rich command detection is available immediately.
0 commit comments