[clangd] Merge index-provided completions with those from Sema.
authorSam McCall <sam.mccall@gmail.com>
Fri, 19 Jan 2018 14:34:02 +0000 (14:34 +0000)
committerSam McCall <sam.mccall@gmail.com>
Fri, 19 Jan 2018 14:34:02 +0000 (14:34 +0000)
commit545a20d90b8e5b89ad97e8da274bc05bf17920eb
treeae7259aaece5ff1cb5b59298602ccb3c7dc956ab
parentb065dabd103ece6b8d5d01f8342d344b5bc589d7
[clangd] Merge index-provided completions with those from Sema.

Summary:
 - we match on USR, and do a field-by-field merge if both have results
 - scoring is post-merge, with both sets of information available
   (for now, sema priority is used if available, static score for index results)
 - limit is applied to the complete result set (previously index ignored limit)
 - CompletionItem is only produces for the returned results
 - If the user doesn't type a scope, we send the global scope for completion
   (we can improve this after D42073)

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, mgrang, cfe-commits

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

llvm-svn: 322945
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/FuzzyMatch.h
clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp