diff --git a/src/PowerShellEditorServices.Host/EditorServicesHost.cs b/src/PowerShellEditorServices.Host/EditorServicesHost.cs index 3fdeb7085..c0275efce 100644 --- a/src/PowerShellEditorServices.Host/EditorServicesHost.cs +++ b/src/PowerShellEditorServices.Host/EditorServicesHost.cs @@ -303,6 +303,12 @@ private void OnDebugServiceClientConnect(object sender, TcpSocketServerChannel s this.debugServiceListener.Start(); } + else if (this.debugAdapter.IsUsingTempIntegratedConsole) + { + this.logger.Write( + LogLevel.Normal, + "Previous temp debug session ended"); + } else { // Exit the host process diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs index d0a2435ff..86437b16c 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs @@ -52,6 +52,12 @@ public class LaunchRequestArguments /// public string Cwd { get; set; } + /// + /// Gets or sets a boolean value that determines whether to create a temporary + /// integrated console for the debug session. Default is false. + /// + public bool CreateTemporaryIntegratedConsole { get; set; } + /// /// Gets or sets the absolute path to the runtime executable to be used. /// Default is the runtime executable on the PATH. diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index 77c0ad29a..914dde649 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -54,6 +54,12 @@ public DebugAdapter( this.ownsEditorSession = ownsEditorSession; } + /// + /// Gets a boolean that indicates whether the current debug adapter is + /// using a temporary integrated console. + /// + public bool IsUsingTempIntegratedConsole { get; private set; } + public void Start() { // Register all supported message types @@ -313,6 +319,7 @@ protected async Task HandleLaunchRequest( this.scriptToLaunch = launchParams.Script ?? launchParams.Program; #pragma warning restore 618 this.arguments = arguments; + this.IsUsingTempIntegratedConsole = launchParams.CreateTemporaryIntegratedConsole; // If the current session is remote, map the script path to the remote // machine if necessary