Repository navigation
Add Options to terminate temporary debug console on exit #2247
Description
Activity
- addedIssue-EnhancementA feature request (enhancement).A feature request (enhancement).Needs: TriageMaintainer attention needed!Maintainer attention needed!
on Jul 24, 2025 - added a parent issue
on Jul 24, 2025 JustinGrote commented
on Jul 24, 2025 CollaboratorMore actionsAs discussed on Discord, I'd ideally like to define a
leaveOpenor similar debug option, and that option is false by default with alaunchand true by default with anattach, 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:
- LSP has its main Runspace in the "main" process
- DAP Server is always started as an additional runspace in the same "main" process
- 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.
jborean93 commented
on Aug 1, 2025 ContributorAuthorMore actionsWhen looking into this a bit I think this might actually belong in
vscode-powershelland 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.jborean93 commented
on Aug 4, 2025 ContributorAuthorMore actionsOpened PowerShell/vscode-powershell#5255 which implements this option in the extension as that is in control of the terminal lifetime.
jborean93 commented
on Aug 26, 2025 ContributorAuthorMore actionsImplemented with PowerShell/vscode-powershell#5255 in the vscode extension.
Prerequisites
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, orcustomPipeNameoptions 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
DisconnectRequesthandler to close the process and terminal pane in the VSCode editor.