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)
| 15 | // AddCompleteSyms adds given symbols as matches in the given match data |
| 16 | // Scope is e.g., type name (label only) |
| 17 | func 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 |
no test coverage detected