<div dir="ltr"><div dir="ltr">On Sun, Aug 4, 2019 at 9:26 PM Björn Linse via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">While working on implementing proper UTF-16 support for a LSP client,<br>
I received this very confusing error message:<br>
<br>
stderr E[12:26:16.762] Failed to update<br>
/home/bjorn/dev/neovim/src/nvim/ui.c: Change's rangeLength (24)<br>
doesn't match the computed range length (24).<br>...<br>
The *EndIndex - *StartIndex should rather be ComputedRangeLength in<br>
the error message I think.</blockquote><div>Indeed, thanks! Fixed in <a href="https://reviews.llvm.org/rL367811" target="_blank">https://reviews.llvm.org/rL367811</a><br></div><div><br></div><div>Since you're looking at this, I'd mention that the only three places clangd deals with the encoding are:</div><div> - encoding/decoding LSP `Position` objects</div><div> - handling `TextDocumentContentChangeEvent`</div><div> - producing `ParameterInformation.labelOffsets` as part of signature help (this one is easy to miss)</div><div>I'd be interested if you know of any others we missed!</div><div><br></div><div>BTW clangd in particular supports -offset-encoding=utf-8, and encoding negotiated by LSP extensions[1], but that doesn't help you if you need to handle arbitrary language servers.</div><div><br></div><div>1: <a href="https://clangd.github.io/extensions.html#utf-8-offsets" target="_blank">https://clangd.github.io/extensions.html#utf-8-offsets</a></div></div></div>