VS Code extension: insertAtMention with multiple conversation tabs reveals a hidden session and steals focus
Status Closed — duplicate
Reported on v2.1.220
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 1 comment · opened Jul 28, 2026 · closed Aug 15, 2026
Environment
- Claude Code VS Code extension 2.1.220 (also observed on 2.1.219)
- VS Code 1.130.0 (commit 1b6a188127eeaf9194f945eb6eb89a657e93c54c), macOS (darwin arm64)
Steps to reproduce
- Open several Claude Code conversations as editor tabs in one window (same tab group).
- Focus a text editor and select a few lines.
- Run "Claude Code: Insert @-Mention Reference" (
claude-vscode.insertAtMention, defaultOption+K).
Observed
- The
@file#N-Mmention is inserted into the visible conversation's prompt (correct). - But the Claude tab group then flips its active tab to a different, previously hidden conversation, and keyboard focus moves there. With multiple conversation tabs this happens on every invocation, and it consistently lands on a conversation the user was not working in.
Expected
The visible conversation receives the mention and stays active. Focus behavior should be predictable: either stay in the text editor or move to the conversation that received the mention - never to a different session.
Analysis (from reading the bundled extension.js)
claude-vscode.insertAtMentionfires one shared event carrying the mention text.- Every open session subscribes to that event. On fire, each session sends
insert_at_mentionto its own webview and then, if it has a panel tab, callsthis.panelTab.reveal()- with no arguments, sopreserveFocusis false. - Hidden sessions' webviews are suspended, so their inserts are harmless, but their
reveal()still executes on the extension host side. The last reveal wins and flips the tab group to a hidden conversation. WebviewPanel.reveal()is a fire-and-forget$revealRPC on the VS Code side (confirmed against the matching vscode source tag), so the tab flip lands asynchronously after the command completes. That also means a user-siderunCommandschain cannot reliably undo it.
Suggested fix
Any of these would resolve it:
- Only the session that receives the mention (the visible / most recently active conversation) calls
reveal(). - Skip
reveal()for sessions whose webview is not visible. - Call
reveal()withpreserveFocus: true(this still flips the visible tab, so the first two options are better).
Workaround in use
A small personal extension that snapshots each tab group's active tab, runs insertAtMention, polls until the reveal lands, and restores the previous state. It works, but the asynchronous reveal makes a visible flicker unavoidable, which is why an upstream fix would be appreciated.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗