Repository navigation
Make structural diffs reusable outside the Source Control view - #350137
Draft
Dirk Bäumer (dbaeumer) wants to merge 1 commit into
Draft
Dirk Bäumer (dbaeumer) wants to merge 1 commit into
Dirk Bäumer (dbaeumer) wants to merge 1 commit into
Conversation
This was referenced Nov 24, 2026
Dirk Bäumer (dbaeumer)
force-pushed
the
dbaeumer/structural-diff-model
branch
8 times, most recently
from
November 25, 2026 13:23
5043686 to
9e3a1e4
Compare
The model that loads and refreshes the structural changes of files now works with any kind of file, which an adapter describes, and reports in telemetry which view requested them. The Source Control view uses it through a subclass. Finding where a diff editor shows a structural item moved into a helper that other views can use too. The state of Show Structural Diff moved from the Source Control view into the SCM view service, so that other views can follow it, and the styles of structural rows that do not depend on the Source Control view moved into a stylesheet that the renderer imports. The Source Control view does not change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dirk Bäumer (dbaeumer)
force-pushed
the
dbaeumer/structural-diff-model
branch
from
November 25, 2026 14:37
9e3a1e4 to
8a0f771
Compare
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Active findings identify incorrect reveal positioning after wrapped inline deletions and a reveal wait that can remain unresolved and retain removed items when pending diffs are canceled.
No open issues 🎉
What changed in this PR
Prepares structural diffs for reuse outside Source Control, ahead of the multi-file diff editor’s structural file list. The stacked changes also improve range navigation in multi-file diffs.
Changes:
- Extracts an adapter-based structural diff model, shared renderer styles, and navigation target helper.
- Moves the workspace visibility toggle into
ISCMViewServiceand adds telemetry location tracking. - Improves range revealing for wrapped, deleted, collapsed, and pending diff content, with regression tests.
| File | Description |
|---|---|
src/vs/workbench/contrib/scm/test/common/scmStructuralDiff.test.ts |
Updates telemetry expectations with the view location. |
src/vs/workbench/contrib/scm/test/browser/scmViewService.test.ts |
Tests shared structural diff visibility state. |
src/vs/workbench/contrib/scm/test/browser/scmStructuralDiff.test.ts |
Tests the service-backed toggle command. |
src/vs/workbench/contrib/scm/common/scmStructuralDiff.ts |
Extracts the generic model, adapter, and navigation helper. |
src/vs/workbench/contrib/scm/common/scm.ts |
Exposes structural diff visibility through the service. |
src/vs/workbench/contrib/scm/browser/scmViewService.ts |
Owns and synchronizes workspace visibility preferences. |
src/vs/workbench/contrib/scm/browser/scmViewPane.ts |
Uses service-owned visibility state. |
src/vs/workbench/contrib/scm/browser/scmStructuralDiffRenderer.ts |
Generalizes rendering and reuses the navigation helper. |
src/vs/workbench/contrib/scm/browser/media/scmStructuralDiff.css |
Adds reusable structural row styles. |
src/vs/workbench/contrib/scm/browser/media/scm.css |
Removes styles moved to the shared stylesheet. |
src/vs/editor/test/browser/widget/multiDiffEditorWidget.test.ts |
Adds range-reveal regression coverage. |
src/vs/editor/common/multiDiffEditor.ts |
Documents which document reveal ranges reference. |
src/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.ts |
Coordinates list scrolling, deferred reveals, and inline range mapping. |
src/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget.ts |
Adds explicit document-side reveal options. |
src/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.ts |
Calculates reveal offsets and preserves vertical scrolling. |
src/vs/editor/browser/widget/diffEditor/utils.ts |
Accepts readonly position mappings. |
src/vs/editor/browser/widget/diffEditor/diffEditorWidget.ts |
Exposes true-inline rendering state. |
Review effort: Balanced
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of 3 stacked PRs that show structural changes in the file list of the multi-file diff editor:
Prepares structural diffs for views other than the Source Control view, which the next PR uses for the file list of the multi-file diff editor. The Source Control view does not change.
Change
StructuralDiffModel<T>inscmStructuralDiff.tsloads, caches and refreshes the structural changes of any kind of file. AnIStructuralDiffResourceAdapter<T>tells which documents a file compares, how its elements are identified, and which view it belongs to.SCMStructuralDiffModelis the Source Control view's subclass. ThescmStructuralDiffRequestedtelemetry event gains alocationproperty,scmormultiDiffEditor.getSCMStructuralDiffTargetreturns where a diff editor shows a structural item.openSCMStructuralDiffuses it, and so will the file list.SCMViewPaneintoISCMViewService(showStructuralDiffandsetShowStructuralDiff), with the same workspace storage key, so that other views can follow it without reading the storage of the Source Control view.scm.cssintoscmStructuralDiff.css, which the renderer imports.Testing
scripts\test.bat --run src/vs/workbench/contrib/scm/test/browser/scmStructuralDiff.test.ts --run src/vs/workbench/contrib/scm/test/browser/scmViewService.test.ts --run src/vs/workbench/contrib/scm/test/common/scmStructuralDiff.test.ts: passed (96 tests), including a new test of the Show Structural Diff state in the service.pnpm run typecheck-client: passed.pnpm run stylelinton the changed CSS files: passed.scm/scmStructuralDiffandscm/scmResourceDecorations(dark theme, 9 fixtures) are identical to those ofmain.