menu

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	// Name is the displayed name of the item.
	// This is also used when searching for menu items.
	Name string

	// Aliases are a search terms for which this item will always rank first.
	Aliases []string

	// Action is the action to perform when the user selects the menu item.
	// This should be a function that accepts a single *EditorState arg.
	Action any
}

Item represents an item in the editor's menu.

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

Search performs approximate text searches for menu items matching a query string.

func NewSearch

func NewSearch(items []Item, emptyQueryShowAll bool) *Search

func (*Search) Execute added in v1.3.0

func (s *Search) Execute(q string)

Execute searches for the given query.

func (*Search) Results

func (s *Search) Results() []Item

Results returns the menu items matching the current query. Items are sorted descending by relevance to the query, with ties broken by lexicographic ordering.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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