package coq-lsp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=36340f464107ac60bb4033fad249984690cdcce3a6bef4ca439ffb2a4458dbf9
sha512=4866f4c2f0acda0c114e27b32cd60fa054333e1c7249227b8c3b23a316d7f306676203bd317f135a40368a292b7b49b76f0bdacff21d7e9bfb5a422d1c8d6ad8
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