Fix range length comparison in DraftStore::UpdateDraft when Unicode characters are...
authorSam McCall <sam.mccall@gmail.com>
Tue, 23 Oct 2018 11:51:53 +0000 (11:51 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 23 Oct 2018 11:51:53 +0000 (11:51 +0000)
commit71891129510bffa27c5cd345135483db4522b3a2
treea385d9b0a83504b80d340301b84d8408e1d45646
parent98b5f6d1596d17e5e6c7def7cf218da71dbefd85
Fix range length comparison in DraftStore::UpdateDraft when Unicode characters are removed from the document

Summary:
See http://lists.llvm.org/pipermail/clangd-dev/2018-October/000171.html for context.

I kept the error (instead of downgrading to a log message) since the range lengths differing does indicate either a bug in the client or server range calculation or the buffers being out of sync (which both seems serious enough to me to be an error). If any existing clients aside from VSCode break they should only break when accidentally typing a Unicode character which should only be a minor nuisance for a little while until the bug is fixed in the respective client.

Patch by Daan De Meyer!

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D53527

llvm-svn: 345020
clang-tools-extra/clangd/DraftStore.cpp
clang-tools-extra/clangd/SourceCode.cpp
clang-tools-extra/clangd/SourceCode.h
clang-tools-extra/unittests/clangd/SourceCodeTests.cpp