Skip to content

Add SCM graph commit-file context menus #6

@MelbourneDeveloper

Description

@MelbourneDeveloper

Problem

VSCode's standard SCM graph lets a commit expand to show the files changed in that commit. Diffr currently covers commit-row context menus and file context menus in SCM Changes, editor tabs, and Explorer, but it does not expose the primary compare actions on the nested file rows inside an expanded graph commit.

That leaves a gap: a user should be able to drill into a file inside a commit and compare that exact historical file path against another commit, a branch, a tag, the index, or the working copy.

Desired behavior

Right-clicking a file inside an expanded SCM graph commit should show the primary three Diffr actions:

  • Diffr: Compare with...
  • Diffr: Compare with Working Copy
  • Diffr: Compare with Previous

Command behavior:

  • Side A is always the selected file at the containing commit.
  • Compare with... opens the existing SideB picker and supports commit, branch/tag, index, and working copy targets.
  • Compare with Working Copy opens one native VSCode diff against the current workspace file.
  • Compare with Previous opens one native VSCode diff against the containing commit's first parent, using the previous path for renames when VSCode exposes it.
  • The flow must not open the changed-file picker, because the selected graph row already fixes the path.

Implementation notes

  • First verify the exact VSCode menu contribution point and command argument shape in a real Extension Development Host. Commit rows currently use scm/historyItem/context with contribSourceControlHistoryItemMenu; nested commit-file rows must be proven rather than guessed.
  • Add a pure historyFileContext extractor that scans all command args, ignores a provider-first SourceControl arg, and returns the containing SHA plus selected relative path.
  • Add separate history-file commands so commit-row and normal workspace-file commands keep their current behavior.
  • Deleted files should render a deterministic empty side. Renames should use the old path on the parent side when the SCM graph payload provides it.

Acceptance criteria

  • Right-clicking a file inside an expanded SCM graph commit shows the three Diffr actions.
  • Each action opens exactly one TabInputTextDiff for the selected file.
  • Compare-with can target another commit, branch, tag, index, or working copy.
  • Unit tests cover argument extraction, including provider-first and malformed payloads.
  • E2E tests invoke the commands with the captured real SCM graph file-row args and assert expected URIs and human-readable diff titles.
  • Manual smoke covers modified, added, deleted, and renamed files.

Docs updated

  • docs/specs/spec.md
  • docs/plans/plan.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions