[PATCH] D40548: [clangd] Prototyping index support and naive index-based global code completion. WIP

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 07:32:36 PST 2017


ioeric added a comment.

In https://reviews.llvm.org/D40548#937626, @malaperle wrote:

> Hi Eric! As you might know I'm working on persisted indexing. I was wondering which cases needed the index for code completion? Could you give a small example? I thought the AST alone would be sufficient for that. I'll look at this patch more closely a bit later but I can look at what needs to be added in the persisted index interface/data.
>
> If you'd like to see the work in progress, it's here:
>  https://github.com/MarkZ3/clang-tools-extra/blob/IndexFunctionsPrototype
>  https://github.com/MarkZ3/clang-tools-extra/blob/IndexFunctionsPrototype/clangd/index/README


Hi Marc! Yes, I was aware of your work. I wanted to upload the prototype early on to get discussions started, especially to get alignment with your work on work space index.

As Ilya said, we would like clangd to support global code completion and other LSP features based on global index (i.e. all symbols in the code base). For example, for code completion on scope specifiers "nx::ny::", we want to be able to complete "nx::ny::X" even if the symbol is not in the AST yet. However, it might not always be feasible to rely on clangd to generate index for a huge code base, so we want to be able to support plugging in additional index sources. The index can be from opened files in clangd, all files in the project (e.g. clangd/ directory), or all files in a huge code base. IIUC, the persistent index you are working on would fall into the project index bucket?

This patch tries to define interfaces for all indexes and how they would be used/merged in clangd, and we would really like your feedback on it. The code completion and AST index changes in the patch are mostly for experimenting with the interfaces.


https://reviews.llvm.org/D40548





More information about the cfe-commits mailing list