[BUG] VSCode extension: unsent input text is lost when switching sessions

Resolved 💬 2 comments Opened May 22, 2026 by jgoslow Closed May 26, 2026

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 I type a message in the Claude Code input field in the VSCode extension but do not send it, then click the sessions panel to switch to another session (or open a new one), my typed text is permanently lost. There is no way to recover it.

A compounding trigger: the extension binds Cmd+N to "new chat," which conflicts with VSCode's native new-file shortcut. If you click into a panel that doesn't capture focus (e.g. Markdown Preview) and press Cmd+N expecting a new file, the extension creates a new session instead — silently wiping any draft in progress.

This is a long-standing issue. It was previously reported in #34596, which was closed as stale by a bot without being fixed or acknowledged.

What Should Happen?

Unsent input text should be preserved per session and restored when switching back to that session. This is standard behavior in Slack, Discord, Telegram, and most chat UIs. The extension already tracks session state — persisting draft text in extension storage is a straightforward addition.

Error Messages/Logs

Steps to Reproduce

  1. Open the Claude Code panel in VSCode
  2. Start typing a message in the input field — do NOT press Enter
  3. Click the sessions icon at the top of the panel to open the session list
  4. Switch to any other session (or create a new one)
  5. Switch back to the original session
  6. Result: the input field is empty — the typed text is gone with no way to recover it

Alternate trigger (accidental):

  1. Type a draft message in the input field
  2. Click a Markdown Preview tab (focus appears to leave the chat panel, but Cmd+N is still captured)
  3. Press Cmd+N expecting VSCode's "new file"
  4. Result: a new Claude Code session is created instead, and the draft is silently lost

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.71

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

This was previously reported in #34596 (closed as stale, not fixed, now locked).
The Cmd+N shortcut conflict makes this worse than it looks — it's easy to accidentally trigger a session switch without realizing it, and the loss is silent.
Fix suggestion: store per-session draft input in VSCode extension state (context.workspaceState or globalState) and restore it when the user returns to a session.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗