AutocompleteOverlay
Category: UI
Source: autocomplete_overlay.dart
Result of accepting an autocomplete suggestion.
Represents the full new buffer contents and the absolute cursor position within it. Each overlay computes its own splicing strategy and returns the result, so the router can apply it uniformly with editor.setText(result.text, cursor: result.cursor).
Classes
AcceptResult
Result of accepting an autocomplete suggestion.
Represents the full new buffer contents and the absolute cursor position within it. Each overlay computes its own splicing strategy and returns the result, so the router can apply it uniformly with editor.setText(result.text, cursor: result.cursor).
Constructor
const AcceptResult(this.text, this.cursor)Properties
| Property | Type | Description |
|---|---|---|
text | String | |
cursor | int |
abstract AutocompleteOverlay
Common contract for in-input autocomplete overlays.
Three implementations live in cli/lib/src/ui/:
- [SlashAutocomplete] — command palette triggered by
/ - [ShellAutocomplete] — tab completion triggered inside bash mode
- [AtFileHint] —
@filereference hint
The router dispatches Up/Down/Tab/Enter/Esc to whichever overlay is currently [active]. Trigger semantics (how an overlay becomes active in the first place) differ per overlay and are NOT part of this interface — each overlay keeps its own update/requestCompletions entry point.
Properties
| Property | Type | Description |
|---|---|---|
active | bool get | Whether the overlay is currently shown and intercepting input. |
selected | int get | Index of the currently highlighted match. |
matchCount | int get | Number of matches currently displayed. |
overlayHeight | int get | Rows the overlay occupies when rendered. |
active | bool get | Whether the overlay is currently shown and intercepting input. |
selected | int get | Index of the currently highlighted match. |
matchCount | int get | Number of matches currently displayed. |
overlayHeight | int get | Rows the overlay occupies when rendered. |
Methods
void moveUp()
Move selection up (wraps).
void moveDown()
Move selection down (wraps).
AcceptResult? accept(String buffer, int cursor)
Accept the current selection, given the editor's current [buffer] and absolute [cursor] position. Returns the new buffer + cursor, or null if nothing to accept.
void dismiss()
Hide the overlay and reset state.
List<String> render(int width)
Render the overlay as styled lines for the given [width].