Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completioner ¶
type Completioner func(ctx context.Context, query string) ([]Suggestion, error)
Completioner is a function that provides suggestions for a query string.
type Model ¶
type Model struct {
Input textinput.Model
List listbox.ListModel
Selection *Suggestion
Width int
Height int
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the autocomplete widget.
func New ¶
func New(completioner Completioner, width, height int) Model
New creates a new autocomplete model with the given completioner.
func (*Model) ApplyHighlighting ¶
func (m *Model) ApplyHighlighting()
ApplyHighlighting applies highlighting to all suggestions in the list You should call this after setting items in the list if you want to display highlighted text
func (*Model) CustomizeStyles ¶
CustomizeStyles allows modifying the list's pointer style
type Span ¶
type Span struct {
Start, End int // rune offsets, half-open [Start,End)
}
Span represents a range of runes to highlight within a suggestion.
type Suggestion ¶
type Suggestion struct {
Id string // Unique identifier
Value string // The actual value (for programmatic use)
DisplayText string // The displayed value (for viewing)
Submatches []Span // Regions to highlight
}
Suggestion is a completion result with associated metadata and highlight regions.
func (Suggestion) Display ¶
func (s Suggestion) Display() string
Display returns the display text of the suggestion (implements listbox.Item)
func (Suggestion) ID ¶
func (s Suggestion) ID() string
ID returns the unique identifier of the suggestion (implements listbox.Item)
type SuggestionsMsg ¶
type SuggestionsMsg []Suggestion
SuggestionsMsg is a message containing new completion suggestions.