hanchenye-llvm-project/clang-tools-extra
Simon Marchi 9808262ede [clangd] Support incremental document syncing
Summary:
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@ericsson.com>

Reviewers: malaperle, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: MaskRay, klimek, mgorny, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 328500
2018-03-26 14:41:40 +00:00
..
change-namespace [change-namespace] Don't match a function call/ref multiple times. 2018-03-15 14:45:02 +00:00
clang-apply-replacements [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
clang-doc [clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework" 2018-03-22 23:34:46 +00:00
clang-move Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>" 2018-02-27 15:54:41 +00:00
clang-query Fix for LLVM r326109 2018-02-26 20:21:30 +00:00
clang-reorder-fields [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
clang-tidy [clang-tidy] Enable Python 3 support for add_new_check.py 2018-03-24 10:49:17 +00:00
clang-tidy-vs
clangd [clangd] Support incremental document syncing 2018-03-26 14:41:40 +00:00
docs [clang-tidy] Use :doc: for check links in Release Notes. 2018-03-21 17:06:13 +00:00
include-fixer Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>" 2018-02-27 15:54:41 +00:00
modularize clang-tidy, modularize: return non-zero exit code on errors 2018-03-22 14:18:20 +00:00
pp-trace Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>" 2018-02-27 15:54:41 +00:00
test [clangd] Support incremental document syncing 2018-03-26 14:41:40 +00:00
tool-template [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
unittests [clangd] Support incremental document syncing 2018-03-26 14:41:40 +00:00
.arcconfig [clang-tools-extra] Set up .arcconfig to point to new Diffusion CTE repository 2017-11-27 15:58:25 +00:00
.gitignore
CMakeLists.txt [clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework" 2018-03-22 23:34:46 +00:00
CODE_OWNERS.TXT
LICENSE.TXT Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA. 2017-03-19 17:23:23 +00:00
README.txt

README.txt

//===----------------------------------------------------------------------===//
// Clang Tools repository
//===----------------------------------------------------------------------===//

Welcome to the repository of extra Clang Tools.  This repository holds tools
that are developed as part of the LLVM compiler infrastructure project and the
Clang frontend.  These tools are kept in a separate "extra" repository to
allow lighter weight checkouts of the core Clang codebase.

This repository is only intended to be checked out inside of a full LLVM+Clang
tree, and in the 'tools/extra' subdirectory of the Clang checkout.

All discussion regarding Clang, Clang-based tools, and code in this repository
should be held using the standard Clang mailing lists:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

Code review for this tree should take place on the standard Clang patch and
commit lists:
  http://lists.llvm.org/mailman/listinfo/cfe-commits

If you find a bug in these tools, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/