Skip to content

sessions: scope navigation keybindings to non-editor focus#317986

Merged
sandy081 merged 1 commit into
mainfrom
sandy081/session-nav-keybinding-context
May 22, 2026
Merged

sessions: scope navigation keybindings to non-editor focus#317986
sandy081 merged 1 commit into
mainfrom
sandy081/session-nav-keybinding-context

Conversation

@sandy081
Copy link
Copy Markdown
Member

Summary

Adds EditorContextKeys.editorTextFocus.toNegated() to the when clause of the Go Back and Go Forward session navigation keybindings.

Problem

The session navigation keybindings (e.g., Alt+Left/Right on Windows) conflict with editor text navigation shortcuts when a text editor has focus in the Agents window.

Solution

The keybindings now require that the editor text is not focused, so they work everywhere in the Agents window (sidebar, chat area, etc.) but don't interfere with editor shortcuts like word navigation.

Add editorTextFocus.toNegated() to the when clause of Go Back and Go Forward
keybindings so they work everywhere in the Agents window except when a text
editor has focus, preventing conflicts with editor shortcuts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 13:20
@sandy081 sandy081 enabled auto-merge (squash) May 22, 2026 13:20
Copy link
Copy Markdown
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 updates the Agents window (“sessions” layer) navigation keybindings so Go Back / Go Forward only trigger when editor text is not focused, avoiding conflicts with editor-level cursor/navigation shortcuts.

Changes:

  • Adds EditorContextKeys.editorTextFocus.toNegated() to the when clause for sessions.goBack.
  • Adds EditorContextKeys.editorTextFocus.toNegated() to the when clause for sessions.goForward.
  • Imports EditorContextKeys to support the new keybinding context expression.
Show a summary per file
File Description
src/vs/sessions/contrib/sessions/browser/sessionsActions.ts Scopes session back/forward keybindings to non-editor-text focus via EditorContextKeys.editorTextFocus negation.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment on lines 129 to 134
weight: KeybindingWeight.WorkbenchContrib,
win: { primary: KeyMod.Alt | KeyCode.LeftArrow },
mac: { primary: KeyMod.WinCtrl | KeyCode.Minus },
linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Minus },
when: IsSessionsWindowContext,
when: ContextKeyExpr.and(IsSessionsWindowContext, EditorContextKeys.editorTextFocus.toNegated()),
},
Comment on lines 169 to 174
weight: KeybindingWeight.WorkbenchContrib,
win: { primary: KeyMod.Alt | KeyCode.RightArrow },
mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.Minus },
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Minus },
when: IsSessionsWindowContext,
when: ContextKeyExpr.and(IsSessionsWindowContext, EditorContextKeys.editorTextFocus.toNegated()),
},
@sandy081 sandy081 merged commit bf51c48 into main May 22, 2026
26 checks passed
@sandy081 sandy081 deleted the sandy081/session-nav-keybinding-context branch May 22, 2026 13:44
@vs-code-engineering vs-code-engineering Bot added this to the 1.122.0 milestone May 22, 2026
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.

3 participants