[BUG] @ reference using alt+k hotkey switches claude code conversation tab on visual studio in ubuntu (and adds the reference)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
claude-vscode.insertAtMention throws "Webview is disposed" and shifts editor focus when Claude chat panel is not in the rightmost editor group
Summary
Pressing Alt+K (default keybinding for claude-vscode.insertAtMention) throws Error: Webview is disposed inside the extension's command handler, and visibly causes VSCode focus to jump to a different editor tab instead of inserting an @-reference into the Claude chat input. The bug only manifests when the Claude chat panel is not the active editor in the rightmost editor group.
Environment
- Claude Code extension:
anthropic.claude-code2.1.128 (also reproduced on 2.1.126 — same call sites) - VSCode: 1.118.1 (commit
034f571df509819cc10b0c8129f66ef77a542f0e), x64 - OS: Pop!_OS 22.04 LTS, kernel 6.8.0-76060800daily20240311-generic, GNOME on X11
Steps to reproduce
- Open the Claude Code chat as an editor tab in a group that is not the rightmost editor group (e.g. left split of two, or middle group of three).
- Click into the chat input so it has focus.
- Press
Alt+K.
Expected: an @-mention is inserted at the cursor in the chat input.
Actual: editor focus jumps to a different editor tab; the correct chat input does receive the @. Extension Host log records Error: Webview is disposed. With the chat panel in the rightmost group, the same keystroke works correctly, although the focus seems to switch back then forward.
Keybinding troubleshooter (rules out a binding conflict)
[KeybindingService]: | Resolving alt+[KeyK]
[KeybindingService]: \ From 1 keybinding entries, matched claude-vscode.insertAtMention,
when: editorTextFocus, source: user extension Anthropic.claude-code.
[KeybindingService]: + Invoking command claude-vscode.insertAtMention.
An unknown error occurred. Please consult the log for more details.
Extension Host stack trace (2.1.128)
Error: Webview is disposed
at mN.assertNotDisposed (vs/workbench/api/node/extensionHostProcess.js:642:112415)
at mN.reveal (vs/workbench/api/node/extensionHostProcess.js:642:112271)
at pp.value (anthropic.claude-code-2.1.128-linux-x64/extension.js:805:1721)
at T._deliver (extensionHostProcess.js:403:3244)
at T._deliverQueue (extensionHostProcess.js:403:3333)
at T.fire (extensionHostProcess.js:403:3667)
at (anthropic.claude-code-2.1.128-linux-x64/extension.js:873:10672)
at Pg._executeContributedCommand (extensionHostProcess.js:503:48683)
at Pg.$executeContributedCommand (extensionHostProcess.js:503:49654)
at i._doInvokeHandler (extensionHostProcess.js:407:157015)
at i._invokeHandler (extensionHostProcess.js:407:156763)
at i._receiveRequest (extensionHostProcess.js:407:155545)
at i._receiveOneMessage (extensionHostProcess.js:407:154383)
... (MessagePort delivery frames)
Likely root cause
extension.js:805 calls .reveal() on a webview reference that is already disposed. The handler at extension.js:873 (the insertAtMention command path) appears to be holding a stale reference. The "non-rightmost group" precondition suggests the handler is resolving the target webview by editor-group position rather than by id, and picks the wrong (disposed) one when the live chat panel isn't where it expects.
What Should Happen?
the @ should be placed in the window without changing focus
Error Messages/Logs
Error: Webview is disposed
at mN.assertNotDisposed (vs/workbench/api/node/extensionHostProcess.js:642:112415)
at mN.reveal (vs/workbench/api/node/extensionHostProcess.js:642:112271)
at pp.value (anthropic.claude-code-2.1.128-linux-x64/extension.js:805:1721)
at T._deliver (extensionHostProcess.js:403:3244)
at T._deliverQueue (extensionHostProcess.js:403:3333)
at T.fire (extensionHostProcess.js:403:3667)
at (anthropic.claude-code-2.1.128-linux-x64/extension.js:873:10672)
at Pg._executeContributedCommand (extensionHostProcess.js:503:48683)
at Pg.$executeContributedCommand (extensionHostProcess.js:503:49654)
at i._doInvokeHandler (extensionHostProcess.js:407:157015)
at i._invokeHandler (extensionHostProcess.js:407:156763)
at i._receiveRequest (extensionHostProcess.js:407:155545)
at i._receiveOneMessage (extensionHostProcess.js:407:154383)
... (MessagePort delivery frames)
Steps to Reproduce
Steps to reproduce
- Open the Claude Code chat as an editor tab in a group that is not the rightmost editor group (e.g. left split of two, or middle group of three).
- Click into the chat input so it has focus.
- Press
Alt+K.
Expected: an @-mention is inserted at the cursor in the chat input.
Actual: editor focus jumps to a different editor tab; the correct chat input does receive the @. Extension Host log records Error: Webview is disposed. With the chat panel in the rightmost group, the same keystroke works correctly, although the focus seems to switch back then forward.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.128
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗