Documentation
¶
Overview ¶
Package complete implements the code completion algorithm for Elvish.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgGenerator ¶
ArgGenerator is the type of functions that generate raw candidates for a command argument. It takes all the existing arguments, the last being the argument to complete, and returns raw candidates or an error.
type CodeBuffer ¶
CodeBuffer is the same the type in src.elv.sh/pkg/el/codearea, replicated here to avoid an unnecessary dependency.
type ComplexItem ¶
type ComplexItem struct { Stem string // Used in the code and the menu. CodeSuffix string // Appended to the code. Display string // How the item is displayed. If empty, defaults to Stem. DisplayStyle ui.Style // Use for displaying. }
ComplexItem is an implementation of RawItem that offers customization options.
func (ComplexItem) Cook ¶
func (c ComplexItem) Cook(q parse.PrimaryType) mode.CompletionItem
func (ComplexItem) String ¶
func (c ComplexItem) String() string
type Config ¶
type Config struct { // An interface to access the runtime. Complete will return an error if this // is nil. PureEvaler PureEvaler // A function for filtering raw candidates. If nil, no filtering is done. Filterer Filterer // Used to generate candidates for a command argument. Defaults to // Filenames. ArgGenerator ArgGenerator }
Config stores the configuration required for code completion.
type PlainItem ¶
type PlainItem string
PlainItem is a simple implementation of RawItem.
func (PlainItem) Cook ¶
func (p PlainItem) Cook(q parse.PrimaryType) mode.CompletionItem
type PureEvaler ¶
type PureEvaler interface { EachExternal(func(cmd string)) EachSpecial(func(special string)) EachNs(func(string)) EachVariableInNs(string, func(string)) PurelyEvalPrimary(pn *parse.Primary) interface{} PurelyEvalCompound(*parse.Compound) (string, bool) PurelyEvalPartialCompound(*parse.Compound, int) (string, bool) }
PureEvaler encapsulates the functionality the completion algorithm needs from the language runtime.
type RawItem ¶
type RawItem interface { String() string Cook(parse.PrimaryType) mode.CompletionItem }
RawItem represents completion items before the quoting pass.
func FilterPrefix ¶
FilterPrefix filters raw items by prefix. It can be used as a Filterer in Config.
func GenerateFileNames ¶
GenerateFileNames returns filename candidates that are suitable for completing the last argument. It can be used in Config.ArgGenerator.