| 7 | ) |
| 8 | |
| 9 | func (s *Session) completeWord(line string, pos int) (string, []string, string) { |
| 10 | prefix, suffix := line[:pos], line[pos:] |
| 11 | |
| 12 | if strings.TrimSpace(prefix) == "" { |
| 13 | return prefix, []string{indent}, suffix |
| 14 | } |
| 15 | |
| 16 | if strings.HasPrefix(strings.TrimSpace(prefix), ":") { |
| 17 | return s.completeCommand(prefix, suffix) |
| 18 | } |
| 19 | |
| 20 | pos, candidates, err := s.completeCode(line, pos, true) |
| 21 | if err != nil { |
| 22 | errorf("completeCode: %s", err) |
| 23 | return "", nil, "" |
| 24 | } |
| 25 | |
| 26 | return line[:pos], candidates, "" |
| 27 | } |
| 28 | |
| 29 | func (s *Session) completeCommand(prefix, suffix string) (string, []string, string) { |
| 30 | commas, prefix := cutPrefixFunc(prefix, func(c rune) bool { |