Index: clangd/index/dex/dexp/Dexp.cpp =================================================================== --- clangd/index/dex/dexp/Dexp.cpp +++ clangd/index/dex/dexp/Dexp.cpp @@ -50,8 +50,10 @@ } std::vector getSymbolIDsFromIndex(StringRef QualifiedName, - const SymbolIndex *Index) { + const SymbolIndex *Index, + unsigned Limit) { FuzzyFindRequest Request; + Request.Limit = Limit; // Remove leading "::" qualifier as FuzzyFind doesn't need leading "::" // qualifier for global scope. bool IsGlobalScope = QualifiedName.consume_front("::"); @@ -158,6 +160,11 @@ cl::opt Name{ "name", cl::desc("Qualified name to look up."), }; + cl::opt Limit{ + "limit", + cl::init(10), + cl::desc("Max results to display"), + }; void run() override { if (ID.getNumOccurrences() == 0 && Name.getNumOccurrences() == 0) { @@ -173,7 +180,7 @@ } IDs.push_back(*SID); } else { - IDs = getSymbolIDsFromIndex(Name, Index); + IDs = getSymbolIDsFromIndex(Name, Index, Limit); } LookupRequest Request; @@ -216,7 +223,7 @@ } IDs.push_back(*SID); } else { - IDs = getSymbolIDsFromIndex(Name, Index); + IDs = getSymbolIDsFromIndex(Name, Index, /*Limit=*/10); } RefsRequest RefRequest; RefRequest.IDs.insert(IDs.begin(), IDs.end());