Skip to content

feat(source-control): optionally open diffs in a side split - #19182

Open
nwparker wants to merge 3 commits into
split/11866-parked-preview-fixfrom
split/11866-side-split-diffs
Open

nwparker wants to merge 3 commits into
split/11866-parked-preview-fixfrom
split/11866-side-split-diffs

Conversation

@nwparker

@nwparker nwparker commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​379 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​379
Prod 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​409 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​382

ELI5

An optional setting makes Source Control open changed files in a dedicated side split. The diff column stays put while you switch focus between the preview and your terminal.

What Changed / Why

Part 2 of the split of #11866, stacked on #19181. Review this PR against its current base; merge #19181 first, then retarget this PR to main.

Adds “Open Diffs in a Side Split” (default off) to Settings → Git and the Source Control overflow menu. Placement reuses a recorded live column, otherwise a parked preview or existing diff column, otherwise creates a right split. Modifier-click keeps its fresh permanent split behavior; double-click still pins. Includes per-workspace column state, rename/removal/purge cleanup, localized settings search, and regression tests.

Original implementation by Dan Cieslak (@dcieslak19973) in #11866; his Git commit authorship is preserved. During extraction, the worktree-removal cleanup was adapted to current main’s omitByWorktree implementation. A separate follow-up commit completes missing setting and search translations in all six catalogs (en/zh/ja/ko/es/fr). The original whitespace-only constants change was omitted.

Linked Issue

Addresses the optional review-layout workflow in #11839. Split from #11866; builds on #19181.

Visual Proof

Original PR Electron/CDP captures, reused as historical evidence; rendered validation was not rerun on this split head.

The opt-in switch in Source Control:

Overflow toggle

A changed file opens beside the current tabs when enabled:

Side split enabled

Testing

  • 61 tests passed across the seven focused editor, Source Control, settings-search, and pane-layout suites.
  • 46 additional tests passed for worktree purge and remote editor branch actions.
  • Localized settings-search tests rerun after translation completion: 3 passed.
  • Web and Node typechecks, targeted oxlint, localization catalog verification, localization coverage audit, and diff whitespace checks passed.
  • The pnpm wrapper encountered a native node-pty postinstall rebuild collision during later checks; those checks passed using the installed binaries/underlying scripts.
  • Full lint/build and Windows/Linux/runtime UI validation remain for CI/follow-up review.

Review

Checked default-off behavior, column reuse after focus changes, stale recorded groups, explicit placement, modifiers, pinning, and lifecycle cleanup. This uses existing tab APIs for folder workspaces and SSH workspaces. The setting is optional for legacy settings and falls back to false; no new remote operation, stream opcode, Git command, path handling, or platform shortcut is introduced.

Agent skill upstream boundary

  • Not applicable.

dcieslak19973 and others added 2 commits September 6, 2026 19:16
Extracted from #11866 by @dcieslak19973. Includes settings, placement, diff-column lifecycle, and regression coverage.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ One minor nit — the feature is clean and thoroughly tested; a single stale-comment observation is inline.

Reviewed changes

Reviewed the full side-split diff feature against its base split/11866-parked-preview-fix (2 commits).

  • Side-split diff placement — new sourceControlOpenDiffsInSideSplit setting (default off) routes Source Control diff opens into a recorded per-worktree diff column, resolved as: recorded column → parked editor-family preview → existing diff tab → fresh right split. Modifier-click and double-click (pin) semantics preserved.
  • Settings surface — toggle added to the Git settings pane (searchable, localized across all six catalogs) and the Source Control overflow menu.
  • Store state & lifecycle — new diffColumnGroupIdByWorktree slice field with worktree rename/remove/purge cleanup; intentionally not persisted (self-heals via liveness check).
  • Tests — pure-function resolver tests, component/store regression tests, and a localized search test.

The resolver logic (resolveSideSplitDiffColumn) and its caller (resolveDiffOpenPlacement) are correct: the recorded column outranks inference, inference excludes the active group and terminal previews, and the liveness check safely re-infers after a group closes or a stale id lingers. No remote-wire, Git-command, or platform-shortcut surface is introduced, and the global (desktop-only) setting correctly avoids the client-settings RPC lane.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

expect(openDiffsInSideSplitMatchesSearch('branch prefix')).toBe(false)
})

// Why: inject the missing alias so translate() cannot pass via its English fallback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the follow-up commit completed the translations, zh.json now ships sideSplit: "侧边分栏", so this manual addResourceBundle injection no longer changes the outcome — translateSearchKeyword returns [localized, fallback] and the test passes with or without it, making the inject the missing alias rationale stale. Consider dropping the injection/cleanup scaffolding and simply switching the language, keeping the localized-match and English-fallback assertions.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in the merge. I'm holding approval only because the prior review's minor nit is still open — see below.

Reviewed changes

Reviewed the single new commit since the prior review — a merge of the base branch tip (0820839102, "fix(editor): preserve focused previews and promoted tab backing files") into this branch.

  • Merged base-branch editor-preview fix — resolveReplaceablePreviewSlot gained a resolvedGroupId parameter that prefers a preview tab in the resolved group before falling back worktree-wide, and its headless openFiles fallback now bails whenever tab-layer state exists.
  • Promoted-tab backing-file fix — openWorkspaceEditorItem now only re-activates an existing tab for an unpinned preview when that tab is still isPreview, so a promoted permanent tab keeps its backing OpenFile.
  • Regression tests — new focused-group, promoted-tab, and non-focus-stealing tests in editor-parked-preview-reuse.test.ts.

I verified the merge has no behavioral effect on this PR's side-split feature: side-split opens always pass a targetGroupId, so pinnedGroupId is set and resolveEditorOpenTargetGroupId returns the explicit target unchanged — the new resolvedGroupId preference tier and the tightened fallback are both moot on those paths. The merge is clean and the change is well-covered by its own tests.

The one open item is the prior review's minor nit on open-diffs-in-side-split-search.test.ts: the addResourceBundle injection (and its inject the missing alias comment) is now redundant because zh.json ships the nested sideSplit key, so the localized-match assertion passes with or without it. This merge didn't touch that file, so the nit stands; dropping the injection/cleanup scaffolding (and the now-stale comment) is all that's needed before this can be approved.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants