Documentation ¶
Index ¶
- func AddSyms(sym syms.SymMap, scope string, md *Matches)
- func AddSymsPrefix(sym syms.SymMap, scope, seed string, md *Matches)
- func AddTypeNames(typ *syms.Type, scope, seed string, md *Matches)
- func ExtendSeed(matches Completions, seed string) string
- func MatchSeedString(completions []string, seed string) (matches []string)
- func SeedWhiteSpace(text string) string
- type Completion
- type Completions
- type Edit
- type EditFunc
- type Lookup
- type LookupFunc
- type MatchFunc
- type Matches
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSyms ¶
AddSyms adds given symbols as matches in the given match data Scope is e.g., type name (label only)
func AddSymsPrefix ¶
AddSymsPrefix adds subset of symbols that match seed prefix to given match data
func AddTypeNames ¶
AddTypeNames adds names from given type as matches in the given match data Scope is e.g., type name (label only), and seed is prefix filter for names
func ExtendSeed ¶
func ExtendSeed(matches Completions, seed string) string
ExtendSeed tries to extend the current seed checking possible completions for a longer common seed e.g. if the current seed is "ab" and the completions are "abcde" and "abcdf" then Extend returns "cd" but if the possible completions are "abcde" and "abz" then Extend returns ""
func MatchSeedString ¶
MatchSeed returns a list of matches given a list of string possibilities and a seed. The seed is basically a prefix.
func SeedWhiteSpace ¶
SeedWhiteSpace returns the text after the last whitespace
Types ¶
type Completion ¶
type Completion struct { // completion text -- what will actually be inserted if selected Text string // label to show the user -- only used for menu display if non-empty -- otherwise Text is used Label string // icon name Icon string // extra information, e.g. detailed description, type, arguments, etc; not currently used in Pi, but is used for tooltips in GUI Desc string // lang specific or other, e.g. class or type Extra map[string]string }
Completion holds one potential completion
func MatchSeedCompletion ¶
func MatchSeedCompletion(completions []Completion, seed string) (matches []Completion)
MatchSeedCompletion returns a list of matching completion structs given a list of possibilities and a seed. The seed is basically a prefix.
type Completions ¶
type Completions []Completion
Completions is a full list (slice) of completion options
type Edit ¶
type Edit struct { // completion text after special edits NewText string // number of runes, past the cursor, to delete, if any ForwardDelete int // cursor adjustment if cursor should be placed in a location other than at end of newText CursorAdjust int }
Edit is returned from completion edit function to incorporate the selected completion
type EditFunc ¶
EditFunc is passed the current text and the selected completion for text editing. Allows for other editing, e.g. adding "()" or adding "/", etc.
type Lookup ¶
type Lookup struct { // if non-empty, the result is to view this file (full path) Filename string // starting line number within file to display StLine int // ending line number within file EdLine int // if filename is empty, this is raw text to display for lookup result Text []byte }
Lookup is used for returning lookup results
type LookupFunc ¶
LookupFunc is the function called to get the lookup results for given input test and position.
type MatchFunc ¶
MatchFunc is the function called to get the list of possible completions and also determines the correct seed based on the text passed as a parameter of CompletionFunc
type Matches ¶
type Matches struct { // the matches based on seed Matches Completions // seed is the prefix we use to find possible completions Seed string }
Matches is used for passing completions around. contains seed in addition to completions