Documentation
¶
Index ¶
- type ClosedMsg
- type CompletionItem
- func (c *CompletionItem) Desc() string
- func (c *CompletionItem) Filter() string
- func (c *CompletionItem) Finished() bool
- func (c *CompletionItem) Render(width int) string
- func (c *CompletionItem) SetFocused(focused bool)
- func (c *CompletionItem) SetMatch(m fuzzy.Match)
- func (c *CompletionItem) SetNameColumnWidth(w int)
- func (c *CompletionItem) Text() string
- func (c *CompletionItem) Value() any
- type CompletionItemsLoadedMsg
- type Completions
- func (c *Completions) Close()
- func (c *Completions) Filter(query string)
- func (c *Completions) HasItems() bool
- func (c *Completions) IsOpen() bool
- func (c *Completions) KeyMap() KeyMap
- func (c *Completions) Open(depth, limit int) tea.Cmd
- func (c *Completions) Query() string
- func (c *Completions) Render() string
- func (c *Completions) SetItems(files []FileCompletionValue, resources []ResourceCompletionValue)
- func (c *Completions) SetSkillItems(skillItems []SkillCompletionValue)
- func (c *Completions) SetStyles(styles Styles)
- func (c *Completions) Size() (width, height int)
- func (c *Completions) Update(msg tea.KeyPressMsg) (tea.Msg, bool)
- type FileCompletionValue
- type ItemStyles
- type KeyMap
- type ResourceCompletionValue
- type SelectionMsg
- type SkillCompletionValue
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionItem ¶
CompletionItem represents an item in the completions list.
func NewCompletionItem ¶
func NewCompletionItem(text, desc string, value any, styles ItemStyles) *CompletionItem
NewCompletionItem creates a new completion item. desc may be empty.
func (*CompletionItem) Desc ¶
func (c *CompletionItem) Desc() string
Desc returns the item's secondary description, if any.
func (*CompletionItem) Filter ¶
func (c *CompletionItem) Filter() string
Filter implements list.FilterableItem.
func (*CompletionItem) Finished ¶
func (c *CompletionItem) Finished() bool
Finished implements list.Item. Completion items render purely from (text, match, focus); any mutation (SetMatch / SetFocused) bumps Version() so the frozen cache entry invalidates on the next render. Marking them finished lets the F6 list memo skip the per-line work for the steady completions popup.
func (*CompletionItem) Render ¶
func (c *CompletionItem) Render(width int) string
Render implements list.Item.
func (*CompletionItem) SetFocused ¶
func (c *CompletionItem) SetFocused(focused bool)
SetFocused implements list.Focusable.
func (*CompletionItem) SetMatch ¶
func (c *CompletionItem) SetMatch(m fuzzy.Match)
SetMatch implements list.MatchSettable.
func (*CompletionItem) SetNameColumnWidth ¶
func (c *CompletionItem) SetNameColumnWidth(w int)
SetNameColumnWidth sets the shared name-column width used to align descriptions across all rows in the popup.
func (*CompletionItem) Text ¶
func (c *CompletionItem) Text() string
Text returns the display text of the item.
func (*CompletionItem) Value ¶
func (c *CompletionItem) Value() any
Value returns the value of the item.
type CompletionItemsLoadedMsg ¶
type CompletionItemsLoadedMsg struct {
Files []FileCompletionValue
Resources []ResourceCompletionValue
}
CompletionItemsLoadedMsg is sent when files have been loaded for completions.
type Completions ¶
type Completions struct {
// contains filtered or unexported fields
}
Completions represents the completions popup component.
func (*Completions) Filter ¶
func (c *Completions) Filter(query string)
Filter filters the completions with the given query.
func (*Completions) HasItems ¶
func (c *Completions) HasItems() bool
HasItems returns whether there are visible items.
func (*Completions) IsOpen ¶
func (c *Completions) IsOpen() bool
IsOpen returns whether the completions popup is open.
func (*Completions) Open ¶
func (c *Completions) Open(depth, limit int) tea.Cmd
Open opens the completions with file items from the filesystem.
func (*Completions) Query ¶
func (c *Completions) Query() string
Query returns the current filter query.
func (*Completions) Render ¶
func (c *Completions) Render() string
Render renders the completions popup: a bordered box around the item list, with a scrollbar in the right margin when there are more items than fit in the visible height.
func (*Completions) SetItems ¶
func (c *Completions) SetItems(files []FileCompletionValue, resources []ResourceCompletionValue)
SetItems sets the files and MCP resources and rebuilds the merged list.
func (*Completions) SetSkillItems ¶
func (c *Completions) SetSkillItems(skillItems []SkillCompletionValue)
SetSkillItems sets the skill items and opens the popup. Unlike SetItems, the data is already resident in memory (loaded once at startup), so no filesystem scan or tea.Cmd is needed.
func (*Completions) SetStyles ¶
func (c *Completions) SetStyles(styles Styles)
SetStyles updates the styles used when rendering completion items. Existing items are not restyled; subsequent SetItems calls pick up the new styles.
func (*Completions) Size ¶
func (c *Completions) Size() (width, height int)
Size returns the full on-screen size of the popup, including the border and the scrollbar column (when shown).
func (*Completions) Update ¶
func (c *Completions) Update(msg tea.KeyPressMsg) (tea.Msg, bool)
Update handles key events for the completions.
type FileCompletionValue ¶
type FileCompletionValue struct {
Path string
}
FileCompletionValue represents a file path completion value.
type ItemStyles ¶
ItemStyles bundles the styles a CompletionItem needs to render.
type KeyMap ¶
KeyMap defines the key bindings for the completions component.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
DefaultKeyMap returns the default key bindings for completions.
func (KeyMap) KeyBindings ¶
KeyBindings returns all key bindings as a slice.
type ResourceCompletionValue ¶
ResourceCompletionValue represents a MCP resource completion value.
type SelectionMsg ¶
SelectionMsg is sent when a completion is selected.
type SkillCompletionValue ¶
SkillCompletionValue represents a skill completion value.
type Styles ¶
type Styles struct {
ItemStyles
Border lipgloss.Style
}
Styles bundles everything needed to render the popup and its items.