[PATCH] D44272: [clangd] Support incremental document syncing
Simon Marchi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 8 13:26:12 PST 2018
simark created this revision.
Herald added subscribers: cfe-commits, ioeric, jkorous-apple, ilya-biryukov, mgorny, klimek.
simark added a reviewer: malaperle.
This patch adds support for incremental document syncing, as described
in the LSP spec. The protocol specifies ranges in terms of Position (a
line and a character), and our drafts are stored as plain strings. So I
see two things that may not be super efficient for very large files:
- Converting a Position to an offset (the positionToOffset function) requires searching for end of lines until we reach the desired line.
- When we update a range, we construct a new string, which implies copying the whole document.
However, for the typical size of a C++ document and the frequency of
update (at which a user types), it may not be an issue. This patch aims
at getting the basic feature in, and we can always improve it later if
we find it's too slow.
Signed-off-by: Simon Marchi <simon.marchi at ericsson.com>
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D44272
Files:
clangd/ClangdLSPServer.cpp
clangd/ClangdServer.cpp
clangd/ClangdServer.h
clangd/DraftStore.cpp
clangd/DraftStore.h
clangd/Protocol.cpp
clangd/Protocol.h
test/clangd/initialize-params-invalid.test
test/clangd/initialize-params.test
unittests/clangd/CMakeLists.txt
unittests/clangd/DraftStoreTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44272.137648.patch
Type: text/x-patch
Size: 11578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180308/86447737/attachment.bin>
More information about the cfe-commits
mailing list