[VS Code] Confirm before closing a tab with an active Claude session
Problem
Cmd+W / Ctrl+W closes Claude Code tabs instantly with no confirmation, even when Claude is mid-tool-call, waiting on a permission prompt, or has unsent input. Muscle memory makes this easy to trigger — especially when running multiple sessions in tabs, which the docs recommend for parallel work.
This is compounded by the fact that Claude Code steals focus in VS Code (#72376, #87053) — the extension can pull your cursor into a Claude tab you weren't working in, and then Cmd+W kills that session instead of the file you thought was focused.
VS Code already solves this for terminals with running processes and editors with unsaved changes. Claude Code tabs with active sessions should get the same treatment.
Proposed solution
Treat a "hot" session as dirty/unsaved so VS Code's native close-confirmation flow kicks in. A session is hot when any of:
- Claude is actively generating or executing a tool call
- A permission/approval prompt is pending
- The input box has unsent text
This is the whenBusy behavior described in #57561. No prompt needed for idle sessions — only active ones where closing actually loses work or interrupts in-flight operations.
Prior issues
- #57561 — proposed
confirmBeforeClose: "never" | "whenBusy" | "always", duped into #21049 and auto-closed - #21049 — JetBrains-scoped, closed not-planned/stale
- #72376, #87053 — focus-stealing bugs that make accidental closes more likely
Both close-confirmation requests were closed without resolution. This issue narrows the scope to VS Code and the whenBusy case, which is the one that actually costs people work.
Priority
Medium - Nice to have improvement
Feature Category
IDE integration (VS Code)