Skip to content

SlashAutocomplete ​

Category: UI

Source: slash_autocomplete.dart

Classes ​

SlashAutocomplete ​

Controls slash command autocomplete state.

Two modes:

  • Name mode: buffer is /prefix with no space — filters registry by command name / alias.
  • Arg mode: buffer is /<knownCmd> <partial> and the resolved command has a [SlashArgCompleter] attached — filters that command's argument candidates.

The overlay itself only renders — the owning widget (App) intercepts keys and calls [update]/[accept]. [ShellAutocomplete] is the only other overlay with a similar mid-buffer splice pattern, but it only activates in bash mode, so there is no collision risk with slash commands.

Constructor ​

dart
SlashAutocomplete(this._registry)

Properties ​

PropertyTypeDescription
maxVisibleconst
activebool get
matchCountint get
activebool get
matchCountint get
selectedTextString? getThe full command text the current selection would set. Used by the router to detect "Enter on an already-accepted selection" and submit instead of re-accepting.
overlayHeightint get

Methods ​

void dismiss() ​
void update(String buffer, int cursor) ​

Update autocomplete state based on the current editor buffer.

AcceptResult? accept(String buffer, int cursor) ​
List<String> render(int width) ​

Released under the MIT License.