[VS Code] Unsent prompt draft is discarded when switching sessions
Summary
In the VS Code extension, text typed into the prompt input but not yet sent is lost when the user
switches to another session. Returning to the original session shows an empty input. Nothing
warns the user before the text is thrown away, and there's no way to get it back.
This happened 4 times in one day of normal use, each time losing a long prompt that was still
being written.
Environment
| | |
| :- | :- |
| Extension | anthropic.claude-code 2.1.295 |
| VS Code | 1.141.0 |
| OS | Windows 11 Pro (10.0.26200) |
Steps to reproduce
- Open a Claude Code session in the VS Code extension.
- Type a multi-line prompt into the input. Don't send it.
- Switch to another session, for example to check on its progress before sending the prompt.
(This is routine when working across several sessions at once.)
- Switch back to the first session.
Expected: the unsent text is still in that session's input.
Actual: the input is empty, and the draft can't be recovered.
Why it matters
- Long, carefully worded prompts are exactly the ones a user is likely to leave half-written while
checking another session, so those are the ones that get lost.
- Losing text silently is worse than refusing to switch: the user finds out only after coming back.
- Nothing else in VS Code discards typed text like this, so users don't learn to guard against it,
even after it has happened once or twice. Copying the draft to the clipboard first isn't reliable
either: once, a double-click elsewhere in VS Code copied something else, and the saved prompt was
overwritten.
- The CLI already has ways to recover input (
Ctrl+Sstash/restore;Esc Escsaves to history
so Up brings it back; Up after Ctrl+C clears the input), so input recovery is an existing
design goal. The extension has nothing like them that works across sessions.
- The extension documentation doesn't say what happens to a draft when you switch, so users can't
plan around it.
Requested behavior
In order of preference:
- Keep a draft for each session. Save each session's unsent input (text, cursor, attachments,
@-mentions) and restore it when the user comes back, including after a window reload.
- Failing that, a way to recover. Put discarded drafts in the input history so
Upbrings
them back, the way Esc Esc works in the CLI.
- At minimum, a warning. Ask before switching away from a session whose input isn't empty.
Current workaround
Write long prompts in a separate editor tab and paste them in. VS Code's hot exit keeps unsaved
tabs, so the text survives switches and reloads.