Skip to content

Show git changes in a split (side-by-side) diff view in the editor #19208

Description

@kevinushey

Summary

#19204 (from #2846) adds Git change markers to the editor gutter, with a peek line widget showing the index version of a change and a Revert button. It does not offer a side-by-side view of the file.

It would be nice to be able to open a split diff for the current document: the index version of the file on one side (read-only) and the live, editable document on the other, with aligned lines, synchronized scrolling, and change highlighting on both sides -- like "Compare with index" in other editors.

Groundwork

  • The ext-diff.js module shipped with show git changes in the editor gutter #19204 contains Ace's full ace/ext/diff extension, including SplitDiffView, which drives two editors with aligned line numbers, synced scroll/wheel, and change highlighting. It accepts existing editors via diffModel.editorA / editorB.
  • The split editor (View different parts of a source file at the same time #2129) already provides a second view per tab (editorSplit = right / down).
  • The git_diff_base_contents RPC already returns the index version of the file in the document's encoding.

What is needed

  1. A split mode that shows the index version in the secondary view, as a separate read-only session loaded with the base contents (the current split clones the same document, so both views edit the same buffer).
  2. Attach SplitDiffView to the two editors, fed by the gutter module's debounced recompute, and tear it down when the split closes or the base is refreshed.
  3. Check the editor options the view forces on both sides (e.g. customScrollbar, which RStudio does not otherwise enable), and the alignment line widgets' interaction with chunk output and MathJax widgets.

Stacked on #19204.

Activity

  1. self-assigned this
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions