package coq-lsp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=8776582dddfe768623870cf540ff6ba1e96a44a36e85db18ab93d238d640f92a
sha512=2837889bf99bfe715bd0e752782211a76a14aac71ed37a4fb784f4f0abe338352c9c6d8caa37daf79c036997add1cb306c523f793625b38709f3b5e245380223
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