Skip to content

Preserve asynchronous completion in FuzzyCompleter - #2144

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix/fuzzy-async-completion-20261017
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix/fuzzy-async-completion-20261017

Conversation

@FanWu-ai

Copy link
Copy Markdown

Summary

Preserve asynchronous completion when FuzzyCompleter wraps a completer with a custom get_completions_async implementation. Previously, the inherited async method called the synchronous path, so async-only completers could fail or return no results, and a wrapped ThreadedCompleter ran its work on the event-loop thread.

The async path now awaits the wrapped completer, then uses the same fuzzy matching and sorting logic as the synchronous path. With fuzzy matching disabled, it forwards async results directly. Wrapped async generators are closed on cancellation, errors, and early termination.

Verification

  • Five initial regression cases failed against the unchanged implementation.
  • Full suite: 167 tests passed on Linux / Python 3.12.14 (clean baseline: 156 passed).
  • Coverage includes async-only completers, disabled fuzzy matching, threaded execution, sync/async result equivalence, generator cleanup, and cancellation.
  • Repository-wide Ruff lint/format, typos, strict mypy for win32/linux/darwin, all configured pre-commit hooks, and source/wheel builds passed.

Prepared with Codex assistance. Remote CI has not yet run for this change.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 17, 2026 03:48
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