|
| | TextIndex ()=default |
| |
| | TextIndex (std::string text) |
| |
| const std::string & | Text () const |
| |
| size_t | LineCount () const |
| |
| size_t | Utf16Of (size_t byte_offset) const |
| | How many UTF-16 units of the document precede this byte offset.
|
| |
| size_t | ByteOf (size_t utf16_offset) const |
| | The byte offset that many UTF-16 units into the document.
|
| |
| std::pair< int, int > | PositionOf (size_t byte_offset) const |
| | The LSP position – zero-based line, UTF-16 units into it – of a byte offset.
|
| |
| size_t | ByteOfPosition (int line, int character) const |
| | The byte offset of an LSP position, clamped into the document.
|
| |
| size_t | ByteOfSourcePosition (int line, int column) const |
| | Byte offset of a one-based source line and code-point column.
|
| |
A document, and the offset arithmetic every editor protocol needs over it.
Converts between byte offsets and editor position units.
Flow offsets count bytes from the start of the file. LSP positions count UTF-16 code units from the start of a line, while JVM offsets count UTF-16 code units from the start of the document. Both protocol adapters use this conversion.