Diff Chooser
Diff Chooser is a VS Code and Cursor extension that keeps an entire feature
branch visible after work-in-progress commits. It adds a separate Source
Control tree whose file list and editor gutter compare against a branch or
commit you choose.
The built-in Git provider is not modified. Its normal working-tree changes can
remain visible alongside Diff Chooser.
How comparisons work
- Selecting a local or remote branch compares against the merge base between
that branch and the current
HEAD. This shows work added on the current
branch without showing newer commits that only exist on the selected branch.
- Entering a commit hash or Git revision resolves it once and uses that exact
commit.
- Committed, staged, unstaged, and untracked changes are included.
- The selection is stored per repository in workspace state.
- Repositories without a saved selection automatically compare against the
remote's default branch, falling back to
main, master, or trunk.
- A single Diff Chooser view in Source Control groups every Git repository and
worktree detected by VS Code. Each worktree has a collapsible tree labeled with its
branch and baseline, such as
feature/login → main.
- Files are organized into folders. Only worktrees start collapsed each session;
their nested folders start expanded, so opening a worktree reveals all its diffs.
Git refreshes preserve your manual expansion choices. With multiple worktrees,
the title bar has one button to expand or collapse all worktrees and folders.
- Baselines remain independent per worktree, and each group's count stays out
of the global Source Control activity badge.
For example, if a feature branch split from main at commit A, then main
added M1 and the feature branch added F1, selecting main uses A as the
baseline. The resulting comparison shows F1, not the absence of M1.
Commands
The following commands are available from the Command Palette, the shared Diff
Chooser title bar, and each worktree's inline actions (unless noted):
- Diff Chooser: Select Baseline lists local and remote branches and allows
entering an exact commit or revision.
- Diff Chooser: Refresh recalculates the selected baseline and changed
files. The shared title action refreshes every worktree at once.
- Diff Chooser: Clear Baseline removes the saved selection for that
repository (Command Palette only).
- Diff Chooser: Toggle Gutter enables or disables editor gutter markers for
one worktree without hiding its comparison. It uses a power-switch icon;
disabled worktrees are labeled
gutter off.
- Diff Chooser: Expand All Diffs / Collapse All Diffs controls all worktrees
and folders, without changing the built-in Git view. Available in the Command
Palette and in the shared title bar when there is more than one worktree.
Click a changed file in the Diff Chooser tree to open its full comparison.
Editor gutter markers use the same baseline while you edit. Rename comparisons
use the file's original path.
Requirements and limitations
- VS Code API version 1.125 or a compatible Cursor release.
- The
git executable must be available on PATH.
- Diff Chooser retains an additional Source Control provider for gutter markers
because the public extension API cannot replace Git's baseline. Its files live
in the separate Diff Chooser view: native SCM resource groups do not expose
expansion control through the public API. No global SCM settings are changed.
- Built-in Git gutter markers may coexist with Diff Chooser markers.
- Deleted files appear in Source Control and open as a comparison, but cannot
display gutter markers because there is no working file to open.
- Quick diffs are text documents; binary files do not have meaningful gutter
comparisons.
Development
npm install
npm run check
npm run lint
npm test
Use the Run Diff Chooser launch configuration to open an Extension
Development Host when interactive testing is desired. Create a VSIX with:
npm run package
Publishing
Version tags publish independently to both extension registries:
The tag must match the version in package.json. For example, version 0.1.0
is published by pushing the v0.1.0 tag. Both pipelines type-check, lint, and
test the extension before publishing.
Visual Studio Marketplace
Create an Azure DevOps Azure Resource Manager service connection named
diff-chooser-publishing using workload identity federation. Its user-assigned
managed identity must be a Contributor on the pprg1996 Visual Studio
Marketplace publisher. Then create an Azure Pipeline from the existing
azure-pipelines.yml file. No personal access token is stored.
See the official
VS Code publishing guide
for the managed identity, federated credential, service connection, and
Marketplace publisher setup.
Open VSX
Sign the Open VSX Publisher Agreement, generate a dedicated CI access token,
and create the namespace once:
read -s OVSX_PAT
export OVSX_PAT
npx ovsx create-namespace pprg1996
unset OVSX_PAT
Store that token as the OVSX_PAT GitHub Actions secret. Open VSX does not
currently support OIDC trusted publishing, so this dedicated token remains
required. See the official
Open VSX publishing guide
for account and namespace setup.