Documentation ¶
Index ¶
- Variables
- func Complete() tea.Msg
- func OneShotCompleter(nextTrigger time.Duration) tea.Cmd
- func PeriodicCompleter(nextTrigger time.Duration) tea.Cmd
- func RefreshSuggestions[T any](init func() []Suggestion[T]) tea.Cmd
- type CompleteMsg
- type Formatters
- type Manager
- type OneShotCompleterMsg
- type PeriodicCompleterMsg
- type RefreshSuggestionsMessage
- type Suggestion
- type SuggestionMsg
- type SuggestionText
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultNameForeground = "243" DefaultNameBackground = "7" DefaultSelectedNameForeground = "8" DefaultSelectedNameBackground = "14" )
View Source
var ( DefaultDescriptionForeground = "255" DefaultDescriptionBackground = "245" DefaultSelectedDescriptionForeground = "0" DefaultSelectedDescriptionBackground = "6" DefaultErrorTextBackground = "1" )
View Source
var ( DefaultScrollbarColor = "251" DefaultScrollbarThumbColor = "255" )
View Source
var DefaultIndicatorForeground = "8"
Functions ¶
func RefreshSuggestions ¶
func RefreshSuggestions[T any](init func() []Suggestion[T]) tea.Cmd
Types ¶
type CompleteMsg ¶
type CompleteMsg struct{}
type Formatters ¶
type Formatters struct { Name SuggestionText Description SuggestionText ErrorText lipgloss.Style SelectedIndicator lipgloss.Style Scrollbar lipgloss.Style ScrollbarThumb lipgloss.Style Suggestions lipgloss.Style }
func DefaultFormatters ¶
func DefaultFormatters() Formatters
func (Formatters) Minimal ¶
func (f Formatters) Minimal() Formatters
type Manager ¶
type Manager[T any] interface { Init() tea.Cmd Update(msg tea.Msg) tea.Cmd SetMaxSuggestions(maxSuggestions int) MaxSuggestions() int SetSelectionIndicator(selectionIndicator string) SelectionIndicator() string EnableScrollbar() DisableScrollbar() SelectedSuggestion() *Suggestion[T] SelectedIndex() int Suggestions() []Suggestion[T] VisibleSuggestions() []Suggestion[T] MaxSuggestionWidth() (int, int) SelectSuggestion(suggestion Suggestion[T]) UnselectSuggestion() IsSuggestionSelected() bool PreviousSuggestion() NextSuggestion() UpdateSuggestions() tea.Cmd ResetSuggestions() tea.Cmd ClearSuggestions() Error() error ScrollbarBounds() (int, int) ScrollPosition() int Scrollbar() string ScrollbarThumb() string Render(paddingSize int) string ShouldChangeListPosition(msg tea.Msg) bool Formatters() Formatters SetFormatters(formatters Formatters) SetShowSuggestions(showSuggestions bool) }
type OneShotCompleterMsg ¶
type OneShotCompleterMsg struct{}
type PeriodicCompleterMsg ¶
type RefreshSuggestionsMessage ¶
type RefreshSuggestionsMessage[T any] []Suggestion[T]
type Suggestion ¶
type Suggestion[T any] struct { Text string SuggestionText string Description string Metadata T CursorOffset int }
func (Suggestion[T]) GetSuggestionText ¶
func (s Suggestion[T]) GetSuggestionText() string
func (Suggestion[T]) Key ¶
func (s Suggestion[T]) Key() *string
func (Suggestion[T]) Render ¶
func (s Suggestion[T]) Render( selected bool, maxNameLen int, maxDescLen int, formatters Formatters, scrollbar string, indicator string, ) string
type SuggestionMsg ¶
type SuggestionMsg[T any] struct { Suggestions []Suggestion[T] SequenceNumber int Err error }
type SuggestionText ¶
func (SuggestionText) Format ¶
func (t SuggestionText) Format(text string, maxLen int, selected bool) string
func (SuggestionText) HasBackground ¶
func (t SuggestionText) HasBackground() bool
Click to show internal directories.
Click to hide internal directories.