MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / SlashCompletionFragment

Function SlashCompletionFragment

cli/completer.go:37–56  ·  view source on GitHub ↗
(textBeforeCursor string)

Source from the content-addressed store, hash-verified

35}
36
37func 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
58func CompleteVisiblePaths(textBeforeCursor string, cwd string) []Completion {
59 base := cwd

Callers 1

SlashCompletionActiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected