@@ -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 : boolean ;
92
93
private startCancellationTokenSource : vscode . CancellationTokenSource | undefined ;
93
94
private suppressRestartPrompt = false ;
94
95
private versionDetails : IPowerShellVersionDetails | undefined ;
@@ -109,6 +110,8 @@ 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
+ this . shellIntegrationEnabled = vscode . workspace . getConfiguration ( "terminal.integrated.shellIntegration" ) . get < boolean > ( "enabled" ) ?? false ;
114
+
112
115
this . platformDetails = getPlatformDetails ( ) ;
113
116
this . HostName = hostName ;
114
117
this . DisplayName = displayName ;
@@ -449,17 +452,22 @@ export class SessionManager implements Middleware {
449
452
const settings = getSettings ( ) ;
450
453
this . logger . updateLogLevel ( settings . developer . editorServicesLogLevel ) ;
451
454
455
+ const shellIntegrationEnabled = vscode . workspace . getConfiguration ( "terminal.integrated.shellIntegration" ) . get < boolean > ( "enabled" ) ;
456
+
452
457
// 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 ) ) {
458
+ if ( ! this . suppressRestartPrompt
459
+ && this . sessionStatus === SessionStatus . Running
460
+ && ( ( shellIntegrationEnabled !== this . shellIntegrationEnabled
461
+ && ! settings . integratedConsole . startInBackground )
462
+ || settings . cwd !== this . sessionSettings . cwd
463
+ || settings . powerShellDefaultVersion !== this . sessionSettings . powerShellDefaultVersion
464
+ || settings . developer . editorServicesLogLevel !== this . sessionSettings . developer . editorServicesLogLevel
465
+ || settings . developer . bundledModulesPath !== this . sessionSettings . developer . bundledModulesPath
466
+ || settings . developer . editorServicesWaitForDebugger !== this . sessionSettings . developer . editorServicesWaitForDebugger
467
+ || settings . developer . setExecutionPolicy !== this . sessionSettings . developer . setExecutionPolicy
468
+ || settings . integratedConsole . useLegacyReadLine !== this . sessionSettings . integratedConsole . useLegacyReadLine
469
+ || settings . integratedConsole . startInBackground !== this . sessionSettings . integratedConsole . startInBackground
470
+ || settings . integratedConsole . startLocation !== this . sessionSettings . integratedConsole . startLocation ) ) {
463
471
464
472
this . logger . writeVerbose ( "Settings changed, prompting to restart..." ) ;
465
473
const response = await vscode . window . showInformationMessage (
@@ -610,10 +618,6 @@ export class SessionManager implements Middleware {
610
618
} ) ;
611
619
} ;
612
620
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
621
618
622
const clientOptions : LanguageClientOptions = {
619
623
documentSelector : this . documentSelector ,
@@ -624,10 +628,13 @@ export class SessionManager implements Middleware {
624
628
// TODO: fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
625
629
} ,
626
630
// NOTE: Some settings are only applicable on startup, so we send them during initialization.
631
+ // When Terminal Shell Integration is enabled, we pass the path to the script that the server should execute.
632
+ // Passing an empty string implies integration is disabled.
627
633
initializationOptions : {
628
634
enableProfileLoading : this . sessionSettings . enableProfileLoading ,
629
635
initialWorkingDirectory : await validateCwdSetting ( this . logger ) ,
630
- shellIntegrationScript : shellIntegrationEnabled ? shellIntegrationScript : "" ,
636
+ shellIntegrationScript : this . shellIntegrationEnabled
637
+ ? utils . ShellIntegrationScript : "" ,
631
638
} ,
632
639
errorHandler : {
633
640
// Override the default error handler to prevent it from
0 commit comments