Repository navigation
Fix/vscode diff preview edge cases - #1734
Piyushrathoree wants to merge 4 commits into
Conversation
… diffs - Key pending diffs by toolCallId and file path so multiple diff blocks under one tool call no longer overwrite each other. - Diffs opened from the chat no longer move focus to the terminal. - Clear pending diffs and their editors on new chat, resume, and ACP reconnect. Fixes Nano-Collective#1726
nc-review: needs work — 1 blocking, 2 important@Piyushrathoree — there is a blocking item below. The PR correctly fixes all three issues from #1726 (collision keying, focus stealing, missing session cleanup), the production logic is sound and matches the issue text, and the new spec file genuinely exercises each branch it targets. It is blocked, however, by a problematic changeset: the file attributes a VS Code-only fix to 🔴 blocking · The changeset declares
Fix by either (a) dropping the changeset entirely since the change is entirely inside the ignored 🟠 important · The 🟠 important ·
🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Remove the itchy-banks-burn changeset: every change in this PR is inside the ignored nanocoder-vscode package, so it has no CLI release note. Add focus tests for the new-file branch of showDiff, which the existing existing-file test did not exercise. Assert that clearPendingChanges notifies exactly once instead of relying on the add-time count.
Fixes #1726
Description
The VS Code diff preview had three edge cases:
toolCallId. When one tool call reported several diff blocks, earlier blocks were overwritten inDiffManager.workbench.action.terminal.focus, which moved focus to an open terminal.Changes:
diffChangeId(toolCallId, filePath), a shared helper used by both the producer and the "Open Diff" click.showDiff, so the click opens the right file.preserveTerminalFocus = false, so the terminal is not focused. The default is unchanged for the CLI path.DiffManager.clearPendingChanges()closes the diff editors and drops the records. It runs on New Chat, resume, and each ACP handshake (onConnectionReady).Limitation: a tool call that reports several diffs still shows one card, for the first file. The other diffs are stored without collisions, but the UI does not show them yet.
Type of Change
Changeset
Testing
Automated Tests
.spec.tsfiles (plugins/vscode/src/diff-manager.spec.ts, 8 tests)pnpm test:all) — not run in full for this changepnpm run test:ava 'plugins/vscode/src/*.spec.ts', 180 tests)pnpm run test:types:vscode)Manual Testing
Checklist