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