Skip to main content

byte_offset

Function byte_offset 

Source
pub fn byte_offset(text: &str, line: u32, character: u32) -> usize
Expand description

The byte offset of the LSP position (line, character) in text.

A position past the end of its line, or past the end of the text, gives the end of what it points into: that is what editors do with one, and it keeps a rounding error in whoever asked from becoming a panic here.