Persist the unsent input draft per workspace#213
Open
leonidasbarkas98-cpu wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 --noEmitclean.