[clangd] Make file limit for textDocument/rename configurable
authorChristian Kandeler <christian.kandeler@qt.io>
Sat, 22 Oct 2022 08:15:40 +0000 (10:15 +0200)
committerChristian Kandeler <christian.kandeler@qt.io>
Sat, 22 Oct 2022 08:17:41 +0000 (10:17 +0200)
Without this, clients are unable to rename often-used symbols in larger
projects.

Reviewed By: kadircet

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

clang-tools-extra/clangd/tool/ClangdMain.cpp

index 68c0a51..53b6653 100644 (file)
@@ -327,6 +327,14 @@ opt<int> ReferencesLimit{
     init(1000),
 };
 
+opt<int> RenameFileLimit{
+    "rename-file-limit",
+    cat(Features),
+    desc("Limit the number of files to be affected by symbol renaming. "
+         "0 means no limit (default=50)"),
+    init(50),
+};
+
 list<std::string> TweakList{
     "tweaks",
     cat(Features),
@@ -891,6 +899,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
   Opts.BackgroundIndex = EnableBackgroundIndex;
   Opts.BackgroundIndexPriority = BackgroundIndexPriority;
   Opts.ReferencesLimit = ReferencesLimit;
+  Opts.Rename.LimitFiles = RenameFileLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
     IdxStack.emplace_back(std::move(StaticIdx));