Skip to content

Fix Ctrl+W keybinding to close session#298984

Open
benibenj wants to merge 1 commit intomainfrom
benibenj/just-mandrill
Open

Fix Ctrl+W keybinding to close session#298984
benibenj wants to merge 1 commit intomainfrom
benibenj/just-mandrill

Conversation

@benibenj
Copy link
Contributor

@benibenj benibenj commented Mar 3, 2026

Copilot Generated Description: Update the Ctrl+W keybinding to close the current session instead of opening a new one.

Copilot AI review requested due to automatic review settings March 3, 2026 15:32
@benibenj benibenj enabled auto-merge March 3, 2026 15:32
@benibenj benibenj self-assigned this Mar 3, 2026
@vs-code-engineering vs-code-engineering bot added this to the March 2026 milestone Mar 3, 2026
Copy link
Contributor

Copilot AI left a 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 fixes the Ctrl+W / Cmd+W keybinding in the Agent Sessions window so that it "closes" the current session (i.e., navigates to the new-session view) instead of triggering the "new session" action that was previously bound to it. It introduces a dedicated agentSession.close command that calls openNewSessionView() and binds Ctrl+W / Cmd+W to that command.

Changes:

  • Introduces a new CLOSE_SESSION_COMMAND_ID (agentSession.close) command with title "Close Session".
  • Registers the new action via registerAction2 with the appropriate precondition.
  • Rebinds Ctrl+W / Cmd+W to the new CLOSE_SESSION_COMMAND_ID instead of ACTION_ID_NEW_CHAT.

});

const CLOSE_SESSION_COMMAND_ID = 'agentSession.close';
registerAction2(class RefreshAgentSessionsViewerAction extends Action2 {
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new action class is named RefreshAgentSessionsViewerAction, which is already used for the "Refresh Sessions" action at line 364. Two classes registered with registerAction2 have the same name in the same file, which is confusing and makes debugging and stack traces harder. The class should be renamed to something that reflects what it does, such as CloseSessionAction.

Suggested change
registerAction2(class RefreshAgentSessionsViewerAction extends Action2 {
registerAction2(class CloseSessionAction extends Action2 {

Copilot uses AI. Check for mistakes.
}
});

// Register Cmd+W / Ctrl+W to open new session when the current session is non-empty,
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on line 345 still reads "to open new session when the current session is non-empty", which describes the old behavior. Now that the keybinding is bound to CLOSE_SESSION_COMMAND_ID, the comment should be updated to accurately describe the new behavior (navigating away from / closing the current session to the new-session view).

Suggested change
// Register Cmd+W / Ctrl+W to open new session when the current session is non-empty,
// Register Cmd+W / Ctrl+W to close the current session and navigate to the new-session view,

Copilot uses AI. Check for mistakes.
Copy link
Member

@lramos15 lramos15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copilot suggestion about the incorrect name is a good one, so just requesting changes until that's addressed so it doesn't auto merge

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants