Skip to main content

Module TextEdit

Module TextEdit 

Source
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ยง

ComputeLineOffsets ๐Ÿ”’
Pre-compute the byte offset of the start of every line in Source. The returned vec always has at least one entry ([0]).
LinePosToOffset ๐Ÿ”’
Resolve (line, character) to an absolute byte offset in Source. character is counted in UTF-16 code units to match VS Codeโ€™s Range/Position semantics. 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 %XX sequences only.