Skip to content

vscode: one-step 'view issue N' / 'view pr N' from QuickPick + Cmd+K P for direct PR-by-ID open #1179

Description

@amrmelsayed

Summary

Two closely-related improvements to the "view an issue / PR by number" flows in the VS Code extension. Shipping them together because they share code paths, a design rhythm, and a coherent keybinding story.

Part 1 — one-step "view issue N" / "view pr N" from the QuickPick

Today: the QuickPick that offers "View Issue" as an item requires four actions from the user: click "View Issue" → Enter → type number → Enter. Two-tier navigation for what should be one gesture.

Fix: enhance the QuickPick with a onDidChangeValue handler that dynamically inserts numeric-typed items at the top when the user types:

  • User types 1350 (bare number, ≥1 digit) → prepend two dynamic items: View Issue #1350 and View PR #1350
  • User types issue 1350 or view issue 1350 → prepend View Issue #1350
  • User types pr 1350 or view pr 1350 → prepend View PR #1350
  • User types #1350 → same as 1350 (leading # tolerated per existing parseIssueId convention)

Accepting a dynamic item bypasses the "click item → InputBox" chain entirely — one gesture, straight to codev.openBacklogIssue (browser) or the new codev.openPRById (Part 2).

Filter matching for existing static items (View Issue, other picker actions) stays as-is; dynamic items only surface when the input matches the numeric-typed grammar above.

Part 2 — new codev.openPRById command + Cmd+K P keybinding

Today: no direct-open-PR-by-number command exists. The only PR-related commands are codev.referencePRInArchitect (sidebar-driven, injects a #N "title" reference into an architect terminal) and PR-list rendering in the Pull Requests sidebar view. Users who know a PR number by heart have to navigate the sidebar list or use the browser directly.

Fix: mirror codev.openIssueById:

  • New command codev.openPRById, title Codev: Open PR by ID...
  • Keybinding Cmd+K P / Ctrl+K P (verified unused in the current keybindings map)
  • Handler pattern identical to packages/vscode/src/commands/open-issue-by-id.ts:
    • showInputBox with parseIssueId-equivalent validation
    • client.getPR(prId, workspacePath) — reuses forge-agnostic PR fetch (same shape as getIssue)
    • On success, vscode.env.openExternal(pr.url)
    • Fallback to in-editor preview if a codev.viewBacklogPR equivalent exists; otherwise showWarningMessage("Could not open PR #N")
  • New file packages/vscode/src/commands/open-pr-by-id.ts (parallel to open-issue-by-id.ts)
  • Registered in extension.ts alongside openIssueById

If a PR-fetch method doesn't exist on the client yet, add one following the getIssue pattern (thin passthrough to the forge adapter).

Acceptance

  • Q1a: In the QuickPick that hosts "View Issue," typing 1350 shows View Issue #1350 and View PR #1350 at the top. Enter on the first opens issue 1350 in the browser.
  • Q1b: Typing view pr 1350 shows View PR #1350 at the top. Enter opens PR 1350 in the browser.
  • Q1c: Typing anything non-numeric filters the existing items normally; no dynamic items appear.
  • Q2a: Cmd+K P opens an InputBox asking for a PR number. Typing a number and Enter opens that PR in the browser.
  • Q2b: Invalid input rejected with a validation message (matching openIssueById).
  • Q2c: PR not found → showWarningMessage telling the user, no crash.

Scope

  • packages/vscode/src/commands/open-pr-by-id.ts — new file
  • packages/vscode/src/commands/search-backlog.ts (or wherever the "View Issue" QuickPick lives — verify at implement time) — QuickPick type-ahead enhancement
  • packages/vscode/src/extension.ts — command registration for codev.openPRById
  • packages/vscode/package.json — command declaration + keybinding
  • packages/vscode/src/connection-manager.tsgetPR(id, workspacePath) method if missing (parallel to getIssue)
  • Tests: unit-test parseIssueId reuse for PR flow, integration-test the QuickPick's dynamic-item insertion for both 1350 and view pr 1350 cases

Out of scope:

  • Removing or renaming the existing codev.openIssueById — this issue is additive
  • Changes to codev.referencePRInArchitect — different flow (injects into terminal, not browser)
  • Other QuickPicks (approve gate, send message, etc.) — they don't need type-ahead

Related

  • packages/vscode/src/commands/open-issue-by-id.ts — the exact template for openPRById
  • parseIssueId (already forge-neutral per its docstring; reusable for PR IDs as-is)
  • Existing keybindings (verified P slot is free): current family is a (architect terminal), d (send message), g (approve gate), b (forward selection to builder), i (open issue by ID)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/vscodeArea: VS Code extension

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions