[clangd] Lib to compute and represent selection under cursor.
authorSam McCall <sam.mccall@gmail.com>
Fri, 1 Feb 2019 15:05:11 +0000 (15:05 +0000)
committerSam McCall <sam.mccall@gmail.com>
Fri, 1 Feb 2019 15:05:11 +0000 (15:05 +0000)
commit3186e3ceb85d34b89b754c015b2d4db99c4c1230
tree041bfb285e2bd09dbdd0bcf3194d9735c061f6fc
parentfbcbac717436e1614ada754d57c76d789de2abfc
[clangd] Lib to compute and represent selection under cursor.

Summary:
The primary problem this solves is to expose the codeAction selection to
AST-based refactorings in a way that makes it easy and efficient for them to
bind to the right parts of the AST.

It should also allow us to make XRefs based features (textDocument/definition)
more robust, more easily implement textDocument/typeDefinition etc.
As an example, template parameter references can be identified without special
handling.
There should be slight speedup too: we can prune most of the AST traversal
in most cases.

Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection.
That captures a smaller set of AST nodes, has a slightly different way of
representing selections, and generally has mare features and does more work.
The overall shape is pretty similar, and yet I can't quite get to behave as I
expect.

Reviewers: ilya-biryukov, kadircet

Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman

Tags: #clang

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

llvm-svn: 352874
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/Selection.cpp [new file with mode: 0644]
clang-tools-extra/clangd/Selection.h [new file with mode: 0644]
clang-tools-extra/unittests/clangd/CMakeLists.txt
clang-tools-extra/unittests/clangd/SelectionTests.cpp [new file with mode: 0644]