[BUG] Inconsistent preserveFocus on diff-open calls causes IME composition loss (VS Code extension)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript, vscode
Research direction
Start with the three vscode.diff call sites described in extension.js, especially site 3 where the options omit preserveFocus. Compare it with sites 1 and 2, then add the suggested regression test or lint coverage so all diff invocations preserve focus. Done means the affected call consistently passes preserveFocus: true and the relevant check passes.
Written by the indexing model from the issue text.
Description
[BUG] Inconsistent preserveFocus on diff-open calls causes IME composition loss (VS Code extension)
Summary
When Claude Code opens a file-edit diff, it always opens a new editor tab (preview:false, hardcoded, no user setting — same underlying behavior as #42288/#52832/#43619). This report focuses on a more severe side effect: on at least one code path, the diff is opened without preserveFocus: true, which steals editor focus away from the chat input. If the user is mid-composition in an IME (Japanese/Chinese/Korean/Vietnamese input), the forced focus change fires compositionend prematurely, committing the unconverted candidate text and silently corrupting/losing what the user was typing.
Evidence (from extension.js, v2.1.211)
Three call sites invoke vscode.diff with distinct option objects:
I = { preview: false, preserveFocus: true } // site 1
b = { preview: false, preserveFocus: true } // site 2
v = { preview: false } // site 3 - preserveFocus NOT set (defaults to false)
Site 3 is the outlier and the likely source of focus theft.
Steps to reproduce
- Set OS/input method to Japanese (or any IME-based language) and open the Claude Code chat panel in VS Code.
- Start typing a message with kanji conversion in progress (composition not yet confirmed).
- While still mid-composition, trigger a file edit from Claude (or have an in-flight edit complete) that opens a new diff tab via the "site 3" path.
- Observe: the in-progress IME candidate is committed/lost as unconverted text, and the diff tab now has focus instead of the chat input.
Expected behavior
All diff-opening code paths should consistently pass preserveFocus: true (matching sites 1 and 2), so opening a diff never steals focus from wherever the user is actively typing.
Suggested fix
Add preserveFocus: true to the options object at site 3, and add a regression test / lint rule ensuring all vscode.diff invocations in this extension share the same focus-handling options.
Related (broader "opens in new tab" complaints, not IME-specific)
- #42288, #52832, #43619 - closed as not planned/duplicate. This report is scoped narrowly to the focus-stealing/IME-corruption consequence, which those threads did not identify.
Environment
- Claude Code VS Code extension: 2.1.211
- OS: Windows 11 Pro
- VS Code: 1.116.0
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- Avg merge
- 8h 14m
- Merged PRs (30d)
- 18
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anthropics/claude-code
-
area:desktop bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anthropics/claude-code#95572 ·
-
area:agents area:docs bug
Difficulty 1/5 Under an hour Newbie friendliness 95/100
anthropics/claude-code#95540 · 2 comments ·
-
area:docs bug has repro platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#95526 ·
-
area:claude-code-web area:hooks bug has repro
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
anthropics/claude-code#95524 · 1 comment ·
-
area:mcp enhancement external
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#95435 ·
All issues in anthropics/claude-code
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100