completion

package
v1.164.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendItemsMsg

type AppendItemsMsg struct {
	Items []Item
}

AppendItemsMsg appends items to the current completion list without closing the popup. Useful for async loading of completion items.

type CloseMsg

type CloseMsg struct{}

type ClosedMsg

type ClosedMsg struct{}

type Item

type Item struct {
	Label       string
	Description string
	Value       string
	Execute     func() tea.Cmd
	Pinned      bool // Pinned items always appear at the top, in original order
	// Disabled marks an item that is shown for context but cannot be
	// submitted (e.g. a non-restartable toolset for /toolset-restart).
	// Enter/Tab are a no-op on it and it never drives the ghost-suggestion
	// preview; cursor movement over it is still allowed.
	Disabled bool
}

func FilterItems added in v1.140.0

func FilterItems(items []Item, query string, matchMode MatchMode) []Item

FilterItems filters and ranks completion items using the same matching logic as the popup manager.

type Manager

type Manager interface {
	layout.Model

	GetLayers() []*lipgloss.Layer
	Open() bool
	// SetEditorBottom sets the height from the bottom of the screen where the editor ends.
	// This is used to position the completion popup above the editor.
	SetEditorBottom(height int)
}

Manager manages the dialog stack and rendering

func New

func New() Manager

New creates a new completion component

type MatchMode

type MatchMode int

MatchMode defines how completion items are filtered

const (
	// MatchFuzzy uses fuzzy matching (matches anywhere in label)
	MatchFuzzy MatchMode = iota
	// MatchPrefix requires the query to match the start of the label
	MatchPrefix
)

type OpenMsg

type OpenMsg struct {
	Items     []Item
	MatchMode MatchMode
}

type OpenedMsg

type OpenedMsg struct{}

type QueryMsg

type QueryMsg struct {
	Query string
}

type ReplaceItemsMsg

type ReplaceItemsMsg struct {
	Items []Item
}

ReplaceItemsMsg replaces non-pinned items in the completion list. Pinned items (like "Browse files…") are preserved. Useful for full async load that supersedes initial results.

type SelectedMsg

type SelectedMsg struct {
	Value      string
	Execute    func() tea.Cmd
	AutoSubmit bool
}

type SelectionChangedMsg

type SelectionChangedMsg struct {
	Value string
}

SelectionChangedMsg is sent when the selected item changes (for preview in editor)

type SetLoadingMsg

type SetLoadingMsg struct {
	Loading bool
}

SetLoadingMsg sets the loading state for the completion popup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL