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

Function isAfterOpenBracket

backend/plugin/parser/mongodb/completion.go:119–130  ·  view source on GitHub ↗

isAfterOpenBracket checks if the cursor position is inside bracket notation (db[|).

(statement string, byteOffset int)

Source from the content-addressed store, hash-verified

117
118// isAfterOpenBracket checks if the cursor position is inside bracket notation (db[|).
119func isAfterOpenBracket(statement string, byteOffset int) bool {
120 // Scan backwards from cursor to find the nearest unmatched '['.
121 for i := byteOffset - 1; i >= 0; i-- {
122 switch statement[i] {
123 case '[':
124 return true
125 case ']', '\n', ';':
126 return false
127 }
128 }
129 return false
130}
131
132// formatCollectionCandidate formats a collection name for completion context.
133// In bracket context (db[|): returns "name"] to complete the bracket expression.

Callers 1

CompletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected