Diversion for VS CodeSource-control integration for Diversion — registers Diversion as a first-class SCM provider so you can commit, branch, diff, switch, and merge from inside VS Code.
Requirements
InstallingThere's no Marketplace publication yet. Three options: Option 1: install the latest
|
| Platform | dv binary default | Status |
|---|---|---|
| Linux | dv |
Tested. Active development platform. |
| macOS | dv |
Should work; same dv semantics as Linux. Untested. |
| Windows | dv.exe |
Should work; path handling is sep-aware and Windows-tested. Untested with a real Windows dv install. |
If you hit a platform-specific issue, file it with the contents of the
Diversion output channel and we'll triage. The Diversion: Run Performance Trace command's output is also useful — it tells us whether
the daemon and dv itself are responding the way we expect.
Features
Source Control panel
- One Diversion provider per repo, keyed by the actual
.diversion/ancestor — opening a sub-directory still registers correctly. - Resource groups: Conflicts, Staged Changes, Changes, New.
Conflicts (
*.dv-conflict.*sidecars) surface automatically. - Inline +/− buttons on every resource (stage / unstage), plus context-menu Stage / Unstage / Commit Selected / Discard. Multi-select works.
- Staging is persisted per-workspace via
workspaceState, so it survives reloads. - Commit picks the staged paths if any are staged, otherwise commits all
(
dv commit <paths> -m/dv commit -a -m). - QuickDiff (gutter + side-by-side) via reverse-applied unified diff. Binary files skip the diff path and open directly.
Repo header (per-repo … menu)
- Branch pill (
$(git-branch) <name>) — click to switch branches. - Ellipsis button next to it opens a categorised quick-pick: Actions / Branch / Sync / Locks / View. Right-click on the repo row gets you the same menu.
- Sync verbs (no push/pull — Diversion auto-syncs commits): Update Workspace, Pause Sync, Resume Sync, Verify Repository.
History
- VS Code's built-in Source Control Graph populates with branches,
commit timestamps, parents, and per-commit file lists. Clicking a file
opens a real side-by-side diff for that commit (via a
dv-commit:content scheme). - View History webview as a textual fallback.
- Cherry-pick / Revert / Restore-to-commit commands.
Game-dev specific
- Hard locks (
dv lock): 🔒 explorer badges via FileDecorationProvider, Lock / Unlock / List Locks commands. Server-side gated to Studio / Enterprise tiers. - Sync conflict resolution for
*.dv-conflict.*sidecars (a Diversion concept distinct from merge conflicts). - Shelves tree view (
dv shelf): create / apply / delete / rename plus Shelve-and-switch-branch. - Inline blame (
dv annotate) —Diversion: Toggle Blame. Block-grouped GitLens-style.
Performance
- Batched per-commit prefetch when the SCM Graph expands a commit (one
dv diff --base <commit>call instead of N). - Persistent on-disk cache for commit content (50 MB, mtime LRU, segmented by dv version) — re-opening the same commit's diffs is ~1 ms after the first session.
Diversion: Run Performance Traceruns a known battery and writes per-step timings to the output channel, useful for triage.
Not implemented yet
- Selective sync editor (
dv preferences sync_paths_rules). - Workspace switcher (multiple workspaces of the same repo).
- Tag UI (list / create / checkout) — tags exist in dv but aren't surfaced.
- Multi-lane DAG layout in the graph (currently linear-with-merge-markers).
- There is no Push or Pull — Diversion auto-syncs commits. This is by design, not an oversight.
Building
npm install
npm run build # one-shot bundle
npm run watch # esbuild watch mode
npm run typecheck # tsc --noEmit, strict
npm test # vitest unit tests (parsers + CLI runner)
npm run package # produce a .vsix via vsce
Press F5 in VS Code to launch the Extension Development Host. The Run Extension on SampleRepo launch configuration opens an example workspace at ~/Diversion/SampleRepo if you have one.
Testing in a real workspace
# Sanity-check daemon detection from the command line:
node scripts/smoke-detect.mjs ~/Diversion/MyRepo
Settings
| Setting | Default | Description |
|---|---|---|
diversion.path |
"" |
Path to the dv binary. Empty uses platform default (dv on POSIX, dv.exe on Windows). |
diversion.daemonUrl |
"" |
Override the daemon URL. Empty discovers from ~/.diversion/.port. |
diversion.refresh.debounceMs |
300 |
Debounce window (ms) for auto-refresh after file changes. |
diversion.log.level |
"info" |
Output channel verbosity (off/error/warn/info/debug). |
diversion.binaryExtensions |
[] |
Extra file extensions to treat as binary (skip side-by-side diff, open directly). |
Architecture
The extension is a thin wrapper over the dv CLI plus the local daemon's
HTTP surface (/health, /workspaces). The daemon supplies workspace
identity (path → branch / commit / paused state); the CLI supplies
everything else. Output parsing lives in src/diversion/parsers/ with
fixture-backed unit tests in test/unit/parsers/.
For the design rationale, mapping of VS Code SCM concepts to dv commands,
risks (CLI output drift, QuickDiff fragility), and the v0.2+ roadmap, see
docs/PLAN.md.
Hard rules baked into the UX
- Never invent CLI flags. Every flag is verified against
dv help <cmd>. - Never assume git semantics. No push, no pull, no inline merge-conflict markers.
- Always parse
dvoutput through small, fixture-backed parsers — never a single mega-regex.
License
The Unlicense — public domain dedication. See LICENSE.