Refetch on explicit close when input differs from anchor#2104
Merged
curtisman merged 1 commit intomicrosoft:mainfrom Mar 30, 2026
Merged
Refetch on explicit close when input differs from anchor#2104curtisman merged 1 commit intomicrosoft:mainfrom
curtisman merged 1 commit intomicrosoft:mainfrom
Conversation
When the user presses Escape to dismiss the completion menu, if there is typed text beyond the current anchor, issue a background refetch with the full current input. The menu is only reopened if the backend returns a different startIndex (anchor position changed), indicating the grammar found a new parse point. If the anchor is unchanged the completions would be the same ones the user just dismissed, so reopening is suppressed. Conditions where the refetch is skipped (result guaranteed identical): - IDLE: no active session - input === anchor: no prefix typed beyond anchor - noMatchPolicy "accept": closed set, no new completions possible - noMatchPolicy "slide": wildcard boundary, refetch shifts anchor only Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
startIndex(anchor advanced), indicating the grammar found a new parse point — same anchor means the user already dismissed those exact completions, so reopening is suppressedinput === anchor,noMatchPolicy=accept(closed set),noMatchPolicy=slide(wildcard boundary)Changes
partialCompletionSession.ts: newexplicitHide()public method +explicitCloseAnchorfield + conditional-reopen guard instartNewSessioncallbackpartial.ts: new privateexplicitHide()method;handleSpecialKeysEscape path wired to it instead of rawsearchMenu.hide()grammarE2E.spec.ts: 4 new tests covering no-refetch for closed-set keywords, no-refetch when input equals anchor, refetch with same anchor suppresses reopen, and refetch with full entity advances anchor and reveals next-level completions🤖 Generated with Claude Code