isAfterOpenBracket checks if the cursor position is inside bracket notation (db[|).
(statement string, byteOffset int)
| 117 | |
| 118 | // isAfterOpenBracket checks if the cursor position is inside bracket notation (db[|). |
| 119 | func 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. |