4 ms·
Yup, code points are the way to go. The LSP is a great example of what happens otherwise [1]. The LSP authors made the controversial decision to sync documents
by hgs3 4y ago
Yup, code points are the way to go. The LSP is a great example of what happens otherwise [1]. The LSP authors made the controversial decision to sync documents using line/columns and UTF-16 code unit offsets rather than relying on code points. I fear they dug the hole deeper by expanding the set of supported encodings to UTF-8 and 32 rather than standardizing on code points. I can only hope this is treated as a stop gap solution and a proper switch to code points happens in the next major revision.
It's not immediately obvious, but line/columns are not a good synchronization method either. Unicode has their own definition of what constitutes a line terminator [2], but different programming languages and environments might have their own definition.
[1] https://github.com/microsoft/language-server-protocol/issues/376 https://github.com/microsoft/language-server-protocol/issues...
[2] https://en.wikipedia.org/wiki/Newline#Unicode https://en.wikipedia.org/wiki/Newline#Unicode