[PATCH] D101902: [clangd] Split CC and refs limit and increase refs limit to 1000
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 5 14:40:26 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe623ce6188d6: [clangd] Split CC and refs limit and increase refs limit to 1000 (authored by kbobyrev).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101902/new/
https://reviews.llvm.org/D101902
Files:
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@
init(100),
};
+opt<int> ReferencesLimit{
+ "limit-references",
+ cat(Features),
+ desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+ init(1000),
+};
+
list<std::string> TweakList{
"tweaks",
cat(Features),
@@ -821,6 +829,7 @@
}
#endif
Opts.BackgroundIndex = EnableBackgroundIndex;
+ Opts.ReferencesLimit = ReferencesLimit;
auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
if (StaticIdx) {
IdxStack.emplace_back(std::move(StaticIdx));
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@
/// Enable preview of InlayHints feature.
bool InlayHints = false;
+
+ /// Limit the number of references returned (0 means no limit).
+ size_t ReferencesLimit = 0;
};
ClangdLSPServer(Transport &Transp, const ThreadsafeFS &TFS,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@
void ClangdLSPServer::onReference(const ReferenceParams &Params,
Callback<std::vector<Location>> Reply) {
Server->findReferences(
- Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+ Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
[Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
llvm::Expected<ReferencesResult> Refs) mutable {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101902.343198.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210505/9801ac27/attachment.bin>
More information about the cfe-commits
mailing list