[clangd] Lib to compute and represent selection under cursor.
authorSam McCall <sam.mccall@gmail.com>
Fri, 1 Feb 2019 15:09:41 +0000 (15:09 +0000)
committerSam McCall <sam.mccall@gmail.com>
Fri, 1 Feb 2019 15:09:41 +0000 (15:09 +0000)
commit2048f22892347c28a5e2d6c64b9589cb485cfb3a
tree55398ff79413b4683a6398df98f9176f704f348e
parent3186e3ceb85d34b89b754c015b2d4db99c4c1230
[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: 352875
clang-tools-extra/clangd/Selection.cpp