Expand description
Char offsets in, protocol positions out.
The editor counts chars (ADR-0006 §1); the language protocol counts UTF-16 code
units within a line. Conversion lives here because this crate owns the rope, which
keeps termesh-lsp rope-free and trading only in TextPosition.
Functions§
- offset_
from_ utf16 - The char offset for a protocol position, clamped to the line and to the document. Servers do send out-of-range positions; clamping is the contract, not a bug.
- utf16_
position (line, character)for a char offset, withcharacterin UTF-16 code units.