package coq-lsp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=a89d86ed8b19d09bf3a06acbed690ae2859a7343d9faa03537c76cd492371651
sha512=edae491b284d5ab586c82cea4003a5b477f41ab25a4659431d4bc8caaee39b62de03b64d088ab8c528416210f88f73d4dfe5efbd32b22c70b75c9d18999c1e00
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