Expand description
Pure text-editing utilities shared across workspace and document providers.
These are side-effect-free helper functions that compute line offsets and
translate (line, character) positions to byte offsets, matching VS Codeโs
UTF-16 code unit counting convention for Range/Position values.
Functionsยง
- Compute
Line ๐Offsets - Pre-compute the byte offset of the start of every line in
Source. The returned vec always has at least one entry ([0]). - Line
PosTo ๐Offset - Resolve
(line, character)to an absolute byte offset inSource.characteris counted in UTF-16 code units to match VS CodeโsRange/Positionsemantics. Falls back to EOF when line/character exceeds the source length. - hex_
digit ๐ - percent_
decode ๐ - Minimal percent-decoder for
file://URI paths. Self-contained to avoid an extra crate dependency; handles%XXsequences only.