Skip to content

Persist the unsent input draft per workspace#213

Open
leonidasbarkas98-cpu wants to merge 1 commit into
andrepimenta:mainfrom
leonidasbarkas98-cpu:feat/persist-input-draft
Open

Persist the unsent input draft per workspace#213
leonidasbarkas98-cpu wants to merge 1 commit into
andrepimenta:mainfrom
leonidasbarkas98-cpu:feat/persist-input-draft

Conversation

@leonidasbarkas98-cpu

Copy link
Copy Markdown

The webview already reported the input text to the extension via the debounced saveInputText message and got it back through restoreInputText on panel init — but the draft only lived in memory, so closing the panel's extension host or restarting VS Code lost it (#84).

Changes: the draft is persisted in workspaceState (non-empty drafts on save, key deleted for empty/whitespace-only text), cleared when a message is sent (both on the extension side and in the webview, which cancels the pending debounce), and restoreInputText no longer overwrites a non-empty field — text held alive by retainContextWhenHidden wins over the persisted fallback.

No new message types, settings, or dependencies.

Addresses #84. Based on current main (ab6e307), tsc --noEmit clean.

The webview already reported the input text to the extension via the
debounced saveInputText message and got it back through
restoreInputText on panel init - but _draftMessage lived only in
memory, so closing the panel's extension host or restarting VS Code
lost the draft (andrepimenta#84).

- load _draftMessage from workspaceState ('claudeCodeChat.inputDraft')
  in the constructor,
- persist non-empty drafts in _saveInputText, delete the key for
  empty/whitespace-only text,
- clear the persisted draft when a message is sent (extension side and
  webview side: cancel the pending debounce and post an empty
  saveInputText right after the field is cleared),
- restoreInputText no longer overwrites a non-empty field, so text held
  alive by retainContextWhenHidden wins over the persisted fallback.

No new message types, settings, or dependencies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant