class

Smith::UI::CommandPalette

Inherits Anvil::Widgets::ListPopup < Reference < Object

The autocomplete popup.

The window mechanics — selection, scrolling, the visible slice — come from Anvil::Widgets::ListPopup. What stays here is what is smith's own: a command word is matched by prefix, built-ins sort ahead of skills, and the selection clamps at both ends rather than wrapping.

Constants

VISIBLE_ROWS = 8

How many rows the popup shows before scrolling. Long enough to see a real list, short enough not to bury the prompt.

Constructors

new(all : Array(Completion))
Source

Class methods

filter(items : Array(Completion), query : String) : Array(Completion)

A space ends the command word — what follows is an argument, not a filter.

Source
query_for(text : String) : String | Nil

The query the popup filters on: a leading slash with nothing but the command word typed so far. nil when the text is not a command-in-progress.

Source