pub fn line_col(source: &str, offset: usize) -> (usize, usize)Expand description
1-indexed (line, column) of a byte offset in source. Columns count
characters, not bytes. Lives in the syntax leaf so every layer that maps a
span to a position — the emitter’s assertion locations, bynkc’s short
rendering, and (slice 6) bynk-render — shares one implementation.
This scans from byte 0, so it is O(offset). For repeated lookups over one
snapshot (an LSP request emitting many positions, or the emit source-map
builder resolving every checkpoint), build a LineIndex once and query
it in O(log n) instead — see #732.