Skip to content

Add Options to terminate temporary debug console on exit #2247

Description

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been requested.

Summary

I would like the temporary debug console to close and be removed from the terminal pane after a debug session is complete. It would make sense for the default to be set to not terminate to align with the current behaviour but there might be argument to have it terminate by default when attaching to another process through the computerName, processId, or customPipeName options as there is no local state that would be of use for the user post debugging.

Proposed Design

I assume this could be done in the DisconnectRequest handler to close the process and terminal pane in the VSCode editor.

Activity

  1. JustinGrote commented on Jul 24, 2025

    @JustinGrote
    Collaborator

    As discussed on Discord, I'd ideally like to define a leaveOpen or similar debug option, and that option is false by default with a launch and true by default with an attach, allowing for 4 combinations.

    And what would be "killed" is the PSES instance starting the DAP runspace. If this was done in a separate process, that separate process would also be killed. If it's in the same process as PSES LSP, obviously leave that running as an exception.

    IMHO ideal design as well we may want to investigate:

    1. LSP has its main Runspace in the "main" process
    2. DAP Server is always started as an additional runspace in the same "main" process
    3. DAP "interacts" with a "remote" runspace in that process, whether that is actually remote or something like a named pipe. This would enable basically anything reachable via remoting and custom transports to be debuggable theoretically.

    Only thing is that cleanup and cancellation might end up being difficult that would make sense for DAP to always be its own separate pwsh (or not!) process, that allows for immediate cancellation without coordination by simply killing the process.

  2. jborean93 commented on Aug 1, 2025

    @jborean93
    ContributorAuthor

    When looking into this a bit I think this might actually belong in vscode-powershell and not here. It seems like the VSCode extension is the one in charge of starting the temp console and so should be the one to close when the debug session ends.

  3. jborean93 commented on Aug 4, 2025

    @jborean93
    ContributorAuthor

    Opened PowerShell/vscode-powershell#5255 which implements this option in the extension as that is in control of the terminal lifetime.

  4. jborean93 commented on Aug 26, 2025

    @jborean93
    ContributorAuthor

    Implemented with PowerShell/vscode-powershell#5255 in the vscode extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementA feature request (enhancement).Needs: TriageMaintainer attention needed!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions