Skip to content

fix(completion): keep autocomplete valid while typing - #186

Merged
fcoury merged 1 commit into
mainfrom
fix/autocomplete-lifecycle
Aug 13, 2026
Merged

fix(completion): keep autocomplete valid while typing#186
fcoury merged 1 commit into
mainfrom
fix/autocomplete-lifecycle

Conversation

@fcoury

@fcoury fcoury commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Autocomplete stayed open while the user typed, but its edit snapshot remained pinned to the original buffer revision. Accepting the selection was therefore rejected as stale, and completion items without an LSP textEdit appended their label instead of replacing the typed prefix. Separately, bounded single-item popups reserved zero rows for their candidate and appeared empty.

This change tracks normal typing and backspace as part of the active completion session, rebases safe LSP edit ranges, and continues rejecting unrelated buffer changes. Items without textEdit now replace the active identifier prefix. Popup row accounting now keeps single candidates visible and positions scroll indicators on the actual border rows.

How to Test

  1. In a Python buffer, type torch.man and wait for manual_seed to appear. Continue typing ual, then press Enter. Expect torch.manual_seed with the popup closed and no duplicated text.
  2. Reopen completion, press Backspace while the popup is open, then accept the item. Expect the completion to replace the shortened prefix. Confirm an unrelated programmatic buffer change is still rejected as stale.
  3. Filter completion down to one candidate, including near the top or bottom of the viewport. Expect the candidate row to remain visible rather than an empty bordered popup or lone down arrow.

Automated coverage includes continued typing, backspace, commit characters, LSP edit rebasing, stale-edit rejection, and bounded single-item rendering. cargo test --all-features and cargo clippy --all-targets --all-features -- -D warnings pass.

@fcoury
fcoury merged commit 9d89583 into main Aug 13, 2026
16 checks passed
@fcoury
fcoury deleted the fix/autocomplete-lifecycle branch August 13, 2026 04:28
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