Author: ioeric Date: Tue Jun 12 01:48:20 2018 New Revision: 334485 URL: http://llvm.org/viewvc/llvm-project?rev=334485&view=rev Log: [clangd] Support proximity paths in index fuzzy find.
Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47937 Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/clangd/index/Index.h Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=334485&r1=334484&r2=334485&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue Jun 12 01:48:20 2018 @@ -928,6 +928,7 @@ private: Req.RestrictForCodeCompletion = true; Req.Scopes = getQueryScopes(Recorder->CCContext, Recorder->CCSema->getSourceManager()); + Req.ProximityPaths.push_back(FileName); log(llvm::formatv("Code complete: fuzzyFind(\"{0}\", scopes=[{1}])", Req.Query, llvm::join(Req.Scopes.begin(), Req.Scopes.end(), ","))); Modified: clang-tools-extra/trunk/clangd/index/Index.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=334485&r1=334484&r2=334485&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/index/Index.h (original) +++ clang-tools-extra/trunk/clangd/index/Index.h Tue Jun 12 01:48:20 2018 @@ -271,6 +271,9 @@ struct FuzzyFindRequest { size_t MaxCandidateCount = UINT_MAX; /// If set to true, only symbols for completion support will be considered. bool RestrictForCodeCompletion = false; + /// Contextually relevant files (e.g. the file we're code-completing in). + /// Paths should be absolute. + std::vector<std::string> ProximityPaths; }; struct LookupRequest { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits