fix: reset inline chat state when the edited file is deleted#144
Draft
laileni-aws wants to merge 1 commit into
Draft
fix: reset inline chat state when the edited file is deleted#144laileni-aws wants to merge 1 commit into
laileni-aws wants to merge 1 commit into
Conversation
If a file is deleted while an inline chat suggestion is pending, the task can never be accepted or rejected (its editor is gone). This left the accept/reject code lenses on screen and the Enter-key shortcut context enabled, effectively disabling Enter across the IDE until the window was reopened. Listen for file deletions and, when the deleted file backs the active inline task, run the existing error-cleanup path to clear the lenses and reset the shortcut context.
laileni-aws
force-pushed
the
fix/inline-chat-cleanup-on-file-delete
branch
from
July 15, 2026 21:15
e37f701 to
5e532dc
Compare
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.
Problem
If a file is deleted while an inline chat suggestion is still pending (e.g. you select the whole file, start inline chat, then delete the file before/while the response is generated), the IDE gets stuck:
The only workaround is to reopen the IDE window.
Root cause
InlineChatControllersetsTaskState.WaitingForDecisionand enables the context keyamazonq.inline.codelensShortcutEnabled(which binds Enter to "accept"). Accept/Reject only clean up viareset()once the user acts — butacceptAllChanges/rejectAllChangesearly‑return when they can't find an editor for the task's document. When the file is deleted, there is no editor, soreset()never runs and the lenses + Enter‑shortcut context remain stuck.Fix
Register a
vscode.workspace.onDidDeleteFileslistener in the controller. When the deleted file backs the currently active inline task, run the existinghandleError()cleanup path, which clears the code lenses (updateLenses→ empty) and callsreset()(which unsetsamazonq.inline.codelensShortcutEnabledand clears the task). This restores the IDE without needing to reopen the window.Testing / verification
handleError()cleanup path.InlineChatController— constructing it requires a live language client and streaming dependencies that aren't practical to instantiate in isolation. The fix is intentionally small and delegates to the already‑exercisedhandleError()path. Reviewer visual confirmation of the exact repro (delete file mid‑generation) is welcome.