MCPcopy Create free account
hub / github.com/bytebase/bytebase / getCaretPosition

Function getCaretPosition

backend/plugin/parser/tsql/completion_test.go:134–144  ·  view source on GitHub ↗
(statement string)

Source from the content-addressed store, hash-verified

132}
133
134func getCaretPosition(statement string) (string, int, int) {
135 lines := strings.Split(statement, "\n")
136 for i, line := range lines {
137 if offset := strings.Index(line, "|"); offset != -1 {
138 newLine := strings.Replace(line, "|", "", 1)
139 lines[i] = newLine
140 return strings.Join(lines, "\n"), i + 1, offset
141 }
142 }
143 panic("caret position not found")
144}
145
146var databaseMetadatas = []*storepb.DatabaseSchemaMetadata{
147 {

Callers 3

TestCompletionFunction · 0.70

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected