autocomplete

package
v0.225.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindCommand     = "command"
	KindShortcut    = "shortcut"
	KindSkill       = "skill"
	KindRemoteSkill = "remote skill"
)

Kinds for ShortcutOption: where a "/" suggestion came from, mirroring the desktop composer's badges.

Variables

This section is empty.

Functions

func HighlightMatches added in v0.219.0

func HighlightMatches(text, padded string, matches []int) string

HighlightMatches bolds and underlines the fuzzy-matched bytes of text in padded, keeping the row's foreground color.

Types

type Autocomplete added in v0.207.0

type Autocomplete struct {
	// contains filtered or unexported fields
}

Autocomplete implements inline autocomplete functionality

func NewAutocomplete

func NewAutocomplete(theme tui.Theme, shortcutRegistry ShortcutRegistry) *Autocomplete

NewAutocomplete creates a new autocomplete component

func (*Autocomplete) ClearUsageHint added in v0.207.0

func (a *Autocomplete) ClearUsageHint()

ClearUsageHint clears the current usage hint

func (*Autocomplete) GetCompletionCursorPos added in v0.207.0

func (a *Autocomplete) GetCompletionCursorPos() int

GetCompletionCursorPos returns the explicit caret position requested by the most recent handleSelection call, or 0 to mean "use the caller's default heuristic". Mirrors AutocompleteCompleteEvent.CursorPos.

func (*Autocomplete) GetSelectedShortcut added in v0.207.0

func (a *Autocomplete) GetSelectedShortcut() string

GetSelectedShortcut returns the currently selected shortcut

func (*Autocomplete) GetUsageHint added in v0.207.0

func (a *Autocomplete) GetUsageHint() string

GetUsageHint returns the current usage hint for ghost text display

func (*Autocomplete) HandleKey added in v0.207.0

func (a *Autocomplete) HandleKey(k tea.KeyPressMsg) (bool, string)

HandleKey processes key input for autocomplete navigation

func (*Autocomplete) Hide added in v0.207.0

func (a *Autocomplete) Hide()

Hide hides the autocomplete

func (*Autocomplete) IsVisible added in v0.207.0

func (a *Autocomplete) IsVisible() bool

IsVisible returns whether autocomplete is currently visible

func (*Autocomplete) RefreshToolsList added in v0.207.0

func (a *Autocomplete) RefreshToolsList()

RefreshToolsList forces a reload of the tools list This should be called when MCP servers connect or disconnect

func (*Autocomplete) Render added in v0.207.0

func (a *Autocomplete) Render() string

Render returns the autocomplete suggestions as a string

func (*Autocomplete) SetFileService added in v0.207.0

func (a *Autocomplete) SetFileService(s agentdomain.FileService)

SetFileService sets the project file lister used by the "@" autocomplete trigger. Safe to call with nil; the trigger then shows nothing.

func (*Autocomplete) SetGitHubIssueService added in v0.207.0

func (a *Autocomplete) SetGitHubIssueService(s agentdomain.GitHubIssueService)

SetGitHubIssueService sets the GitHub issue lookup used by the "#" autocomplete trigger. Safe to call with nil; the trigger then shows nothing.

func (*Autocomplete) SetHeight added in v0.207.0

func (a *Autocomplete) SetHeight(height int)

SetHeight sets the height for rendering

func (*Autocomplete) SetModelService added in v0.207.0

func (a *Autocomplete) SetModelService(modelService convdomain.ModelService)

SetModelService sets the model service for model autocomplete

func (*Autocomplete) SetPricingService added in v0.207.0

func (a *Autocomplete) SetPricingService(pricingService convdomain.PricingService)

SetPricingService sets the pricing service for model pricing display

func (*Autocomplete) SetSkillsService added in v0.207.0

func (a *Autocomplete) SetSkillsService(skillsService agentdomain.SkillsService)

SetSkillsService sets the skills service so installed skills appear in the slash-command autocomplete alongside shortcuts.

func (*Autocomplete) SetStateManager added in v0.207.0

func (a *Autocomplete) SetStateManager(stateManager agentdomain.AgentModeState)

SetStateManager sets the state manager for agent mode filtering

func (*Autocomplete) SetToolService added in v0.207.0

func (a *Autocomplete) SetToolService(toolService agentdomain.ToolService)

SetToolService sets the tool service for tool autocomplete

func (*Autocomplete) SetWidth added in v0.207.0

func (a *Autocomplete) SetWidth(width int)

SetWidth sets the width for rendering

func (*Autocomplete) Update added in v0.207.0

func (a *Autocomplete) Update(inputText string, cursorPos int)

Update handles autocomplete logic

type ShortcutOption

type ShortcutOption struct {
	Shortcut    string
	Description string
	Usage       string
	Kind        string
	Matches     []int
}

ShortcutOption represents a shortcut option for autocomplete

type ShortcutRegistry

type ShortcutRegistry interface {
	GetAll() []shortcuts.Shortcut
}

ShortcutRegistry interface for dependency injection

type SubcommandProvider

type SubcommandProvider interface {
	GetSubcommands() []shortcuts.Subcommand
}

SubcommandProvider is an interface for shortcuts that provide subcommands

Jump to

Keyboard shortcuts

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