MCPcopy Create free account
hub / github.com/cogentcore/core / AddCompleteSyms

Function AddCompleteSyms

parse/syms/complete.go:17–38  ·  view source on GitHub ↗

AddCompleteSyms adds given symbols as matches in the given match data Scope is e.g., type name (label only)

(sym SymMap, scope string, md *complete.Matches)

Source from the content-addressed store, hash-verified

15// AddCompleteSyms adds given symbols as matches in the given match data
16// Scope is e.g., type name (label only)
17func AddCompleteSyms(sym SymMap, scope string, md *complete.Matches) {
18 if len(sym) == 0 {
19 return
20 }
21 sys := sym.Slice(true) // sorted
22 for _, sy := range sys {
23 if sy.Name[0] == '_' { // internal / import
24 continue
25 }
26 nm := sy.Name
27 lbl := sy.Label()
28 if sy.Kind.SubCat() == token.NameFunction {
29 nm += "()"
30 }
31 if scope != "" {
32 lbl = lbl + " (" + scope + ".)"
33 }
34 c := complete.Completion{Text: nm, Label: lbl, Icon: sy.Kind.Icon(), Desc: sy.Detail}
35 // fmt.Printf("nm: %v kind: %v icon: %v\n", nm, sy.Kind, c.Icon)
36 md.Matches = append(md.Matches, c)
37 }
38}
39
40// AddCompleteTypeNames adds names from given type as matches in the given match data
41// Scope is e.g., type name (label only), and seed is prefix filter for names

Callers 3

CompleteLineMethod · 0.92
CompletePkgSymsMethod · 0.92
AddCompleteSymsPrefixFunction · 0.85

Calls 4

SliceMethod · 0.80
IconMethod · 0.80
LabelMethod · 0.65
SubCatMethod · 0.45

Tested by

no test coverage detected