Skip to content

Keyboard Shortcut support #280

@ryunosuke21

Description

@ryunosuke21

Summary

We already have a Command Palette, but PR review is still mostly mouse-driven because the palette doesn’t expose PR review actions (and therefore there are no default shortcuts for them). Add a set of PR review commands to the existing palette, and ship sensible default keybindings (GitHub-like where appropriate) for faster review: j/k to move between files, i to toggle comment visibility, plus navigation between threads/unresolved threads.

Problem

Reviewing a PR involves repetitive actions:

  • next/prev file
  • jump between comment threads
  • find unresolved threads
  • toggle comment visibility while scanning diffs
  • quickly start a comment/reply

Today, these aren’t first-class “commands” in the product, so:

  • they can’t be invoked from the Command Palette
  • they can’t be bound to shortcuts consistently
  • it’s harder for both humans and agents to drive review workflows deterministically

Proposal

1) Add PR review commands to the existing Command Palette

Expose a dedicated group/namespace like “Pull Request: …” (or “PR: …”), available when a PR review view is active.

Initial command set (suggested):

File navigation

  • Pull Request: Next file
  • Pull Request: Previous file
  • Pull Request: Open file picker (focus file list / search within changed files)

Threads / discussions

  • Pull Request: Next thread
  • Pull Request: Previous thread
  • Pull Request: Next unresolved thread
  • Pull Request: Previous unresolved thread

Comments visibility

  • Pull Request: Toggle comments visibility
    (see “Scope” below)

Composing

  • Pull Request: Add comment (contextual: selection/line if possible, else general)
  • Pull Request: Reply to thread (when a thread is focused)

2) Provide default keyboard shortcuts that trigger those commands

Use the command system as the single source of truth: shortcuts → commands → handlers.

Suggested defaults (can be adjusted to match existing conventions):

  • j / k: PR Next/Previous file
  • n / p: Next/Previous thread
  • u / shift+u: Next/Previous unresolved thread
  • i: Toggle comments visibility
  • c: Add comment (contextual)
  • r: Reply to focused thread
  • ?: Show keyboard shortcuts help (if present today)

Important: do not capture these while typing in an input/textarea/contenteditable (comment editor, search fields, etc.).

UX details / expected behavior

  • j/k changes the “selected file” and scrolls the diff pane to that file.
  • Thread commands:
    • If a thread is focused, n/p cycles within the current file first (optional), otherwise across the PR.
    • Unresolved navigation should skip resolved threads deterministically.
  • Toggle comments visibility scope:
    • Option A (simplest): toggles comments for the currently selected file.
    • Option B: toggles comments for the entire PR.
    • If both are valuable, consider two commands:
      • Pull Request: Toggle comments for file
      • Pull Request: Toggle comments for PR

Why Command Palette-first

  • Discoverability: users can search “next file”, “toggle comments”, etc.
  • Consistency: the palette becomes the canonical list of “things you can do” in PR review.
  • Extensibility: agents/automation can invoke the same commands (future-friendly) without bespoke UI plumbing.
  • Keybindings become trivial: bind keys to existing commands.

Acceptance criteria

  • In PR review view, the Command Palette shows the new “Pull Request: …” commands listed above.
  • All new commands are invokable via the palette and perform the expected action.
  • Default shortcuts are wired to those commands:
    • j/k navigates files
    • i toggles comment visibility
    • n/p navigates threads
    • u/shift+u navigates unresolved threads
  • Shortcuts do not fire while focus is inside editable fields.
  • Works on macOS and Linux.

Implementation notes (non-prescriptive)

  • Register PR-specific commands only when PR review context is active (avoid polluting global palette).
  • Use the existing command infrastructure; add a small “PR review controller” that exposes:
    • current file index / file list
    • thread list / unresolved thread list
    • actions for select-next/select-prev and toggles
  • Add basic tests for:
    • command registration in PR context
    • keyboard shortcut dispatch → command execution
    • “don’t intercept while typing”

Motivation / reference

GitHub’s PR review flow is dramatically faster with keyboard-driven navigation (j, k, i, etc.). Supporting similar muscle memory (or compatible defaults) would reduce friction and make PR review feel “instant” in this product.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions