Skip to content

[Feature]: Desktop: open any diff in an external tool (Beyond Compare, IntelliJ) - two configurable slots #185

Backlog

Description

@magicprinc

Problem

The review pane's inline diff is good for a glance and bad for real comparison. Zooming in means dragging the side panel, and the pane will never have three-way merge, folder comparison, or the keybindings built up over years in dedicated tools. Today there is no way to hand the diff to Beyond Compare or IntelliJ IDEA from the app at all, even though both are better at exactly this: Beyond Compare for folder trees and merges, IntelliJ for the project-aware view. They are complementary, which is why this needs two slots, not one.

Checked against the shipped 0.1.63 bundle: no external-diff integration exists — no externalDiff, difftool or Beyond Compare strings, and nothing in the issue tracker asks for it.

Proposal

  1. A configurable list of external diff tools in settings — name, executable, and an argument template with the usual placeholders: %local and %remote for the two sides (new and old), plus %path, %base, %title. Two entries should be offered as convenience defaults, detected rather than assumed:
    • Beyond Compare: BCompare.exe /left=%remote /right=%local
    • IntelliJ IDEA: idea64.exe diff %remote %local
  2. "Open diff in…" on every diff surface — the Changes pane's row menu, the diff view's own menu, and an inline edit diff in the transcript — with the configured tools listed by name, so two of them is a menu of two, not a setting to switch.
  3. Materialise both sides. The old side usually does not exist on disk: it is the base the change is compared against, or the file was deleted. The app must write both sides to a temp folder — the old from the diff's base content, the new from the file or from the patch — pass those two paths, and clean up afterwards. A %remote pointing at a missing file is the classic way these integrations silently fail.
  4. Handle the degenerate cases honestly: new file (empty old side), deleted file (empty new side), binary (offer "open the file" instead, or say so), and a file that changed on disk since the diff was taken (warn instead of showing a stale comparison).
  5. Whole-change scope, not only one file: "open the full change set in…" should hand the tool the two directories, which is what Beyond Compare's folder mode is for and what a single-file diff cannot do.

Constraints worth designing around

  • The configured command is user-controlled execution. It must come only from an explicit entry the person typed (never inferred from PATH), and the arguments must be passed as an argv array without a shell, so a path containing & or a quote cannot become a second command.
  • Both sides must be taken against the same base the pane is showing, so the external view and the inline view agree by construction.
  • Temp files are deleted when the comparison closes, and the folder should be obviously named (commandcode-diff-…) so anything left behind is recognisable.

Why this is worth building

The side panel is a triage surface: it tells which files moved and roughly how. Deep reading belongs to the tool the reviewer already lives in. Every IDE has worked this way for twenty years, and it is the cheapest possible integration — a menu item, two temp files and a launch.

Environment

Command Code Desktop 0.1.63, Windows 10 (build 19045) x64.

Activity

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

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