pub fn offset_to_position(source: &str, offset: u32) -> PositionExpand description
Convert a byte offset into source to an LSP Position (0-based line/char).
Handles both LF-only and CRLF line endings. When the offset lands on or
after a \r that immediately precedes \n, the \r is not counted as a
column so that positions are consistent regardless of line-ending style.