(textBeforeCursor string)
| 35 | } |
| 36 | |
| 37 | func SlashCompletionFragment(textBeforeCursor string) (leading string, fragment string, ok bool) { |
| 38 | start := 0 |
| 39 | for start < len(textBeforeCursor) { |
| 40 | r, size := utf8.DecodeRuneInString(textBeforeCursor[start:]) |
| 41 | if !unicode.IsSpace(r) { |
| 42 | break |
| 43 | } |
| 44 | start += size |
| 45 | } |
| 46 | if start >= len(textBeforeCursor) || textBeforeCursor[start] != '/' { |
| 47 | return "", "", false |
| 48 | } |
| 49 | fragment = textBeforeCursor[start:] |
| 50 | for _, r := range fragment { |
| 51 | if unicode.IsSpace(r) { |
| 52 | return textBeforeCursor[:start], fragment, false |
| 53 | } |
| 54 | } |
| 55 | return textBeforeCursor[:start], fragment, true |
| 56 | } |
| 57 | |
| 58 | func CompleteVisiblePaths(textBeforeCursor string, cwd string) []Completion { |
| 59 | base := cwd |
no outgoing calls
no test coverage detected