(text, offset)
| 252 | } |
| 253 | |
| 254 | function offsetToLineCol(text, offset) { |
| 255 | let line = 1, col = 1; |
| 256 | for (let i = 0; i < offset && i < text.length; i++) { |
| 257 | if (text[i] === '\n') { line++; col = 1; } |
| 258 | else col++; |
| 259 | } |
| 260 | return { line, col }; |
| 261 | } |
| 262 | |
| 263 | // ===== Utilities ===== |
| 264 |