@@ -89,6 +89,7 @@ export class SessionManager implements Middleware {
89
89
private sessionDetails : IEditorServicesSessionDetails | undefined ;
90
90
private sessionsFolder : vscode . Uri ;
91
91
private sessionStatus : SessionStatus = SessionStatus . NotStarted ;
92
+ private shellIntegrationEnabled = false ;
92
93
private startCancellationTokenSource : vscode . CancellationTokenSource | undefined ;
93
94
private suppressRestartPrompt = false ;
94
95
private versionDetails : IPowerShellVersionDetails | undefined ;
@@ -109,6 +110,7 @@ export class SessionManager implements Middleware {
109
110
// We have to override the scheme because it defaults to
110
111
// 'vscode-userdata' which breaks UNC paths.
111
112
this . sessionsFolder = vscode . Uri . joinPath ( extensionContext . globalStorageUri . with ( { scheme : "file" } ) , "sessions" ) ;
113
+
112
114
this . platformDetails = getPlatformDetails ( ) ;
113
115
this . HostName = hostName ;
114
116
this . DisplayName = displayName ;
@@ -189,6 +191,9 @@ export class SessionManager implements Middleware {
189
191
// Migrate things.
190
192
await this . migrateWhitespaceAroundPipeSetting ( ) ;
191
193
194
+ // Update non-PowerShell settings.
195
+ this . shellIntegrationEnabled = vscode . workspace . getConfiguration ( "terminal.integrated.shellIntegration" ) . get < boolean > ( "enabled" ) ?? false ;
196
+
192
197
// Find the PowerShell executable to use for the server.
193
198
this . PowerShellExeDetails = await this . findPowerShell ( ) ;
194
199
@@ -447,19 +452,23 @@ export class SessionManager implements Middleware {
447
452
448
453
private async onConfigurationUpdated ( ) : Promise < void > {
449
454
const settings = getSettings ( ) ;
455
+ const shellIntegrationEnabled = vscode . workspace . getConfiguration ( "terminal.integrated.shellIntegration" ) . get < boolean > ( "enabled" ) ;
450
456
this . logger . updateLogLevel ( settings . developer . editorServicesLogLevel ) ;
451
457
452
458
// Detect any setting changes that would affect the session.
453
- if ( ! this . suppressRestartPrompt && this . sessionStatus === SessionStatus . Running &&
454
- ( settings . cwd !== this . sessionSettings . cwd
455
- || settings . powerShellDefaultVersion !== this . sessionSettings . powerShellDefaultVersion
456
- || settings . developer . editorServicesLogLevel !== this . sessionSettings . developer . editorServicesLogLevel
457
- || settings . developer . bundledModulesPath !== this . sessionSettings . developer . bundledModulesPath
458
- || settings . developer . editorServicesWaitForDebugger !== this . sessionSettings . developer . editorServicesWaitForDebugger
459
- || settings . developer . setExecutionPolicy !== this . sessionSettings . developer . setExecutionPolicy
460
- || settings . integratedConsole . useLegacyReadLine !== this . sessionSettings . integratedConsole . useLegacyReadLine
461
- || settings . integratedConsole . startInBackground !== this . sessionSettings . integratedConsole . startInBackground
462
- || settings . integratedConsole . startLocation !== this . sessionSettings . integratedConsole . startLocation ) ) {
459
+ if ( ! this . suppressRestartPrompt
460
+ && this . sessionStatus === SessionStatus . Running
461
+ && ( ( shellIntegrationEnabled !== this . shellIntegrationEnabled
462
+ && ! settings . integratedConsole . startInBackground )
463
+ || settings . cwd !== this . sessionSettings . cwd
464
+ || settings . powerShellDefaultVersion !== this . sessionSettings . powerShellDefaultVersion
465
+ || settings . developer . editorServicesLogLevel !== this . sessionSettings . developer . editorServicesLogLevel
466
+ || settings . developer . bundledModulesPath !== this . sessionSettings . developer . bundledModulesPath
467
+ || settings . developer . editorServicesWaitForDebugger !== this . sessionSettings . developer . editorServicesWaitForDebugger
468
+ || settings . developer . setExecutionPolicy !== this . sessionSettings . developer . setExecutionPolicy
469
+ || settings . integratedConsole . useLegacyReadLine !== this . sessionSettings . integratedConsole . useLegacyReadLine
470
+ || settings . integratedConsole . startInBackground !== this . sessionSettings . integratedConsole . startInBackground
471
+ || settings . integratedConsole . startLocation !== this . sessionSettings . integratedConsole . startLocation ) ) {
463
472
464
473
this . logger . writeVerbose ( "Settings changed, prompting to restart..." ) ;
465
474
const response = await vscode . window . showInformationMessage (
@@ -610,10 +619,6 @@ export class SessionManager implements Middleware {
610
619
} ) ;
611
620
} ;
612
621
613
- // When Terminal Shell Integration is enabled, we pass the path to the script that the server should execute.
614
- // Passing an empty string implies integration is disabled.
615
- const shellIntegrationEnabled = vscode . workspace . getConfiguration ( "terminal.integrated.shellIntegration" ) . get < boolean > ( "enabled" ) ;
616
- const shellIntegrationScript = path . join ( vscode . env . appRoot , "out" , "vs" , "workbench" , "contrib" , "terminal" , "browser" , "media" , "shellIntegration.ps1" ) ;
617
622
618
623
const clientOptions : LanguageClientOptions = {
619
624
documentSelector : this . documentSelector ,
@@ -624,10 +629,13 @@ export class SessionManager implements Middleware {
624
629
// TODO: fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
625
630
} ,
626
631
// NOTE: Some settings are only applicable on startup, so we send them during initialization.
632
+ // When Terminal Shell Integration is enabled, we pass the path to the script that the server should execute.
633
+ // Passing an empty string implies integration is disabled.
627
634
initializationOptions : {
628
635
enableProfileLoading : this . sessionSettings . enableProfileLoading ,
629
636
initialWorkingDirectory : await validateCwdSetting ( this . logger ) ,
630
- shellIntegrationScript : shellIntegrationEnabled ? shellIntegrationScript : "" ,
637
+ shellIntegrationScript : this . shellIntegrationEnabled
638
+ ? utils . ShellIntegrationScript : "" ,
631
639
} ,
632
640
errorHandler : {
633
641
// Override the default error handler to prevent it from
0 commit comments