[clangd] Fix no results returned for global symbols in dexp

Summary:
For symbols in global namespace (without any scope), we need to
add global scope "" to the fuzzy request.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 346947
This commit is contained in:
Haojian Wu 2018-11-15 12:17:41 +00:00
parent cc0829f3cb
commit 5e7486f518
1 changed files with 4 additions and 0 deletions

View File

@ -58,6 +58,10 @@ std::vector<SymbolID> getSymbolIDsFromIndex(StringRef QualifiedName,
auto Names = splitQualifiedName(QualifiedName);
if (IsGlobalScope || !Names.first.empty())
Request.Scopes = {Names.first};
else
// QualifiedName refers to a symbol in global scope (e.g. "GlobalSymbol"),
// add the global scope to the request.
Request.Scopes = {""};
Request.Query = Names.second;
std::vector<SymbolID> SymIDs;