zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.79k stars 78 forks source link

Support for converting line-column pair into byte offset #132

Open segeljakt opened 1 month ago

segeljakt commented 1 month ago

It is currently possible to convert a byte offset into a line-column pair using Source::get_byte_line, but don't see a way to do the inverse operation. It would be a very useful feature when interoperating with LSP, which uses line-column pairs. Is it possible to add? I think it might be enough to make the method Line::byte_span public.