MCPcopy Create free account
hub / github.com/expr-lang/expr / Do

Method Do

repl/repl.go:109–126  ·  view source on GitHub ↗
(line []rune, pos int)

Source from the content-addressed store, hash-verified

107}
108
109func (c completer) Do(line []rune, pos int) ([][]rune, int) {
110 var lastWord string
111 for i := pos - 1; i >= 0; i-- {
112 if line[i] == ' ' {
113 break
114 }
115 lastWord = string(line[i]) + lastWord
116 }
117
118 var words [][]rune
119 for _, word := range c.words {
120 if strings.HasPrefix(word, lastWord) {
121 words = append(words, []rune(strings.TrimPrefix(word, lastWord)))
122 }
123 }
124
125 return words, len(lastWord)
126}
127
128func memoryUsage() uint64 {
129 var m runtime.MemStats

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected