package coq-lsp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=64c07c21284a6cf18c9c79fd614f188ebc552dd7a783a00e51c14cca8d062d07
sha512=9cc3efad65f5896af847880b74833c50897a7e4eba34f61e34b3c5136e237f53c6c38252aeb553b932d26e6b5b252631e758d8a8994c2b7c12cfa989fd5686ff
doc/coq-lsp.lang/Lang/Utf/index.html
Module Lang.Utf
Source
This module provides facilities for translating language-based locations to protocol-based locations.
After a long discussion (thanks Léo !), we have decided that the best is to have `Lang.Point` to store columns offset in the values that are native to the protocol under consideration, set by the upper layers.
This scheme kind of follows what we have done since the start with coq-lsp.
Future work: support setting protocol enconding
Unicode terminology refresher:
- character, code point: The real unicode character
- byte or 16bit offset / code unit: The encoded version
UTF-16 offset from UTF-8 offset; line is enconded in UTF-8
Get the byte position of a code point indexed in UTF-16 code units in a UTF-8 encoded utf8_string. Returns the position of the last character if the UTF-16 position was out of bounds.
To UTF-16 offsets
Length in UTF-16 code points
Not used anywhere, remove?
Number of characters in the utf-8-encoded utf8_string.
Converstion from char to UTF-8/16
UTF-8 Char to byte index position; line is enconded in UTF-8
Get the utf16 position of a code point indexed in unicode code points in a UTF-8 encoded utf8_string. The position must be in bounds.
Converstion to char from UTF-8/16
Byte index to character position also called a codepoint
, line is encoded in UTF-8
Get the unicode position of a code point indexed in UTF-16 code units in a utf-8 encoded utf8_string. Returns the position of the last character if the utf-16 position was out of bounds.
For testing