Skip to main content

Module autocomplete

Module autocomplete 

Expand description

Autocomplete — a text field with a suggestion list that floats below it — and SuggestionList, the floating list itself, which a code editor’s caret completion shares.

A real TextInput (so it inherits selection, clipboard, IME, caret navigation and theming for free, per crates/sdk/ui-core/HIG.md §8) with a suggestion popover drawn in the overlay pass so it composites above sibling content.

Any app attaches a suggestion source — a closure via with_suggester, or a reactively-computed list via set_suggestions — and completions recompute whenever the typed text changes.

Typing opens the dropdown; Down/Up move the highlight; Enter accepts (the highlighted suggestion, or the typed text, which Enter then goes on to the host with, so a form’s default action runs); Tab completes to the highlight without accepting; Esc or an outside click cancels — the outside click is not consumed, so it still reaches the host. The outcome is polled once via take_outcome, rising-edge like TextInput::take_dirty.

The editable path bar in the file manager is the canonical consumer, but the widget knows nothing about paths.

Structs§

Autocomplete
Suggestion
One completion offered in the dropdown.
SuggestionList
A floating list of suggestions under (or, without room, above) an anchor: the one list behind Autocomplete and a code editor’s caret completion.

Enums§

AutocompleteOutcome
How the most recent interaction ended. Returned once by Autocomplete::take_outcome.

Type Aliases§

Suggester
A suggestion source: given the current text, return the completions to show.