[BUG] VS Code terminal steals focus even when running Claude Code externally with /ide (terminal not open)
Open 💬 20 comments Opened Sep 15, 2025 by openclosure
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?
When using Claude Code in an external terminal, while connected to VS Code with the /ide command, VS Code opens the integrated terminal and steals focus upon prompt submission in the external terminal.
What Should Happen?
With CLI running externally, VS Code should not reveal/focus the integrated terminal unless I explicitly open it.
Error Messages/Logs
2025-09-14 21:36:07.286 [info] Unregistered diagnostic client: client_5
2025-09-14 21:44:18.197 [info] New WS connection from: /
2025-09-14 21:44:18.198 [info] MCP server connected to transport
2025-09-14 21:44:18.198 [info] [DiagnosticStreamManager] Started streaming diagnostics
2025-09-14 21:44:18.198 [info] Registered diagnostic client: client_6
2025-09-14 21:44:19.296 [info] Closing all diff tabs in the editor...
2025-09-14 21:44:19.297 [info] Closed 0 diff tabs.
2025-09-14 21:44:19.871 [info] [DiagnosticStreamManager] Notifying 1 clients about diagnostics change for 1 files
2025-09-14 21:44:21.963 [info] WS client disconnected
2025-09-14 21:44:21.964 [info] [DiagnosticStreamManager] Unregistered client client_6. Total clients: 0
2025-09-14 21:44:21.964 [info] [DiagnosticStreamManager] Stopped streaming diagnostics
2025-09-14 21:44:21.964 [info] Unregistered diagnostic client: client_6
2025-09-14 21:45:02.704 [info] New WS connection from: /
2025-09-14 21:45:02.704 [info] MCP server connected to transport
2025-09-14 21:45:02.704 [info] [DiagnosticStreamManager] Started streaming diagnostics
2025-09-14 21:45:02.704 [info] Registered diagnostic client: client_7
2025-09-14 21:45:10.698 [info] Closing all diff tabs in the editor...
2025-09-14 21:45:10.698 [info] Closed 0 diff tabs.
2025-09-14 21:45:11.272 [info] [DiagnosticStreamManager] Notifying 1 clients about diagnostics change for 1 files
Steps to Reproduce
- Open VS Code with a workspace.
- Ensure the integrated terminal is closed.
- In an external terminal, run claude from the workspace root and connect with
/ide. - Type a prompt and press Enter.
- Tab back to VS Code and observe that the integrated terminal is now open.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unsure
Claude Code Version
1.0.113
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Attached logs are from the CC extension in VS code.
GhostTTY Version Info:
Version: 1.1.3
Build: 9438
Commit: 889478f3
VS Code Version Info:
Version: 1.104.0 (Universal)
Commit: f220831ea2d946c0dcb0f3eaa480eb435a2c1260
Date: 2025-09-10T06:46:18.035Z
Electron: 37.3.1
ElectronBuildId: 12342881
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Darwin arm64 24.6.0
21 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Not a duplicate. There are several references to this bug in JetBrains products but I haven't seen a report of this for VS Code/Cursor.
I can confirm the bug report, I observe the same behaviour.
I use latest Ghostty from main branch (version 0c63946bd, build 12105).
Claude Code version 1.0.112 (Claude Code).
VSCode version info:
Just confirming that this bug is still reproducible in November with Claude Code CLI 2.0.31.
The issue reported back in September seems to persist in the current release. But I'm using window platform.
Claude Code v2.0.36 and confirming this bug AGAIN, can you work a bit more instead doing nothing please?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue is still occuring!
Able to reproduce this issue with warp and cursor
I think the best workaround here would be to just introduce a new vscode extension setting to opt-out of the current behaviour which seems to open the terminal panel and focus it.
Still occurring, please fix
Still occurring, please fix
Still running into this - please fix
issue persists on 2.1.42
also confirming this. is there a way to disconnect clude-cli from the claude extention in vs code?
Happening for me on 2.1.79
The focus-stealing happens because the
/ideconnection triggers VS Code to open/activate its terminal panel. Workarounds:Workaround 1 — Prevent terminal auto-focus in VS Code:
This prevents VS Code from auto-focusing the terminal panel when Claude Code sends commands through the IDE integration.
Workaround 2 — Use a separate VS Code window:
Keep your code in one VS Code window and let Claude's
/ideconnection go to a different window. Focus changes in the second window won't interrupt your work in the first.Workaround 3 — Don't use /ide, use file paths instead:
If you primarily need Claude to edit files, it can do so via the Edit/Write tools without IDE integration:
The
/ideconnection is mainly useful for features like "go to definition" and inline diffs. If you don't need those, skipping/ideavoids the focus issue entirely.Workaround 4 — Use the VS Code extension instead of external terminal + /ide:
The Native UI mode in the extension handles IDE integration without the focus-stealing issue, since Claude runs inside VS Code natively.
now, (for me), it happens _twice_, on startup. That's quite disruptive.
https://github.com/anthropics/claude-code/issues/7618#issuecomment-4159655672
(1) does not work; see https://github.com/anthropics/claude-code/issues/23713 for an explanation
(2) This is very awkward; now I'm juggling 3 windows (VSCode 1 where I do my work, VSCode 2 whose only purpose is to feed context to CC, an external terminal running claude code). Also VSCode doesn't really like to have 2 windows open to the same project as far as I know, though I haven't tried it in some time. Historically the only way I've managed to do it was to have one window open to the folder, one window open to a VSCode workspace in the same folder.
(3) That also defeats the entire purpose of having ide integration. "Don't use the thing" is not a workaround
(4) Also defeats the entire purpose of /ide integration
Still reproducible on Claude Code v2.1.126 / VS Code Claude Code extension v2.1.126 (macOS).
Environment
Reproduction
claudein Ghostty/ide→ "Connected to Visual Studio Code"New finding — narrows down the trigger
The pop-up only happens if at least one integrated terminal instance already exists in the current VS Code
session. Specifically:
| State of VS Code's integrated terminal | Pop-up on prompt? |
|---|---|
| Never opened in this VS Code session | ✅ No pop-up |
| Opened before, then hidden (
Cmd+J) | ❌ Pops back || Opened and visible | ❌ Steals focus |
Workaround: restart VS Code and never manually open an integrated terminal. The pop-up does not occur as long as no
terminal instance exists.
This used to work a few weeks ago for me. Certainly way after the opening of this ticket. But it's been doing it every time for the last few weeks. I don't know the exact version.
Almost a year later and this is still an issue.