-
Notifications
You must be signed in to change notification settings - Fork 517
Add temporaryConsoleWindowActionOnDebugEnd option #5255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adds a new option `temporaryConsoleWindowActionOnDebugEnd` to both the attach and launch configurations which can be used to specify what happens with the temporary integrated console when a debug session ends. The option can be set to `keep`, current behaviour and default, that will keep the active terminal as the temporary console. It can be set to `close` which closes the terminal and removes it from the selection pane or `hide` which keeps the terminal window alive but changes the active terminal to the previous one before the debug session started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new configuration option temporaryConsoleWindowActionOnDebugEnd
that controls the behavior of temporary console windows when PowerShell debug sessions end. The feature provides three options: "keep" (default, maintains current behavior), "close" (removes the terminal), and "hide" (restores the previous active terminal).
- Adds the new configuration option to both attach and launch debug configurations
- Implements event handling to manage terminal state when debug sessions terminate
- Provides configurable behavior for temporary console cleanup with backward compatibility
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/features/DebugSession.ts | Implements the core logic for handling terminal state changes and debug session event listening |
package.json | Defines the new configuration schema with enum values and descriptions for both attach and launch configurations |
const previousActiveTerminal = window.activeTerminal; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The previousActiveTerminal
variable is captured at the start of the function but only used much later in the event handler. Consider moving this declaration closer to where the event handler is defined to improve code readability and reduce the scope of the variable.
const previousActiveTerminal = window.activeTerminal; |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be captured here as the temp console is created in the next step and takes over the active terminal.
src/features/DebugSession.ts
Outdated
@@ -600,6 +604,23 @@ export class DebugSessionFeature | |||
); | |||
} | |||
|
|||
const closeDebugEvent = debug.onDidTerminateDebugSession( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event listener is created for every debug session but only handles termination of the specific session. Consider whether this could lead to memory leaks if multiple debug sessions are created rapidly, as the event listener persists until the specific session terminates.
Copilot uses AI. Check for mistakes.
PR Summary
Adds a new option
temporaryConsoleWindowActionOnDebugEnd
to both the attach and launch configurations which can be used to specify what happens with the temporary integrated console when a debug session ends. The option can be set tokeep
, current behaviour and default, that will keep the active terminal as the temporary console. It can be set toclose
which closes the terminal and removes it from the selection pane orhide
which keeps the terminal window alive but changes the active terminal to the previous one before the debug session started.Issue for this feature was opened under PowerShell/PowerShellEditorServices#2247 but the actual implementation needs to be done here.
PR Checklist
WIP:
to the beginning of the title and remove the prefix when the PR is ready