MCPcopy Index your code
hub / github.com/bytebase/bytebase / catchCaret

Function catchCaret

backend/plugin/parser/mongodb/completion_test.go:105–120  ·  view source on GitHub ↗

catchCaret finds the | marker in the input and returns: - the text with the marker removed - the 1-based line number where the marker was - the 0-based column offset on that line

(s string)

Source from the content-addressed store, hash-verified

103// - the 1-based line number where the marker was
104// - the 0-based column offset on that line
105func catchCaret(s string) (string, int, int) {
106 line := 1
107 col := 0
108 for i, c := range s {
109 if c == '|' {
110 return s[:i] + s[i+1:], line, col
111 }
112 if c == '\n' {
113 line++
114 col = 0
115 } else {
116 col++
117 }
118 }
119 return s, -1, -1
120}

Callers 1

TestCompletionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected