aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-10-21 16:29:56 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2022-10-24 11:44:51 +0000
commita459ee5d24302ba33e9b2e0537673aedfba90538 (patch)
tree23ac5eb7b9ecbef1e13bd18f713c6f8b049ae9c3
parent16261ad4723e1400dc1aa06d021501febd0c76e0 (diff)
ClangCodeModel: Re-enable renaming via clangd
The hard rename limit is gone, see https://reviews.llvm.org/D136454. Make the feature opt-in for now, as we still need to do some UI fine- tuning Change-Id: Ic631a5b39711c6f37fffeeec4d2a5f5bf3bde92b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/clangcodemodel/clangdclient.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp
index 8ff6d34119b..329b91b6318 100644
--- a/src/plugins/clangcodemodel/clangdclient.cpp
+++ b/src/plugins/clangcodemodel/clangdclient.cpp
@@ -162,6 +162,8 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
cmd.addArg("--background-index-priority="
+ ClangdSettings::priorityToString(indexingPriority));
}
+ if (settings.clangdVersion() >= QVersionNumber(16))
+ cmd.addArg("--rename-file-limit=0");
if (!jsonDbDir.isEmpty())
cmd.addArg("--compile-commands-dir=" + jsonDbDir.toString());
if (clangdLogServer().isDebugEnabled())
@@ -470,13 +472,13 @@ void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor,
if (searchTerm.isEmpty())
return;
- // TODO: Fix hard file limit in clangd, then uncomment this with version check.
- // Will fix QTCREATORBUG-27978 and QTCREATORBUG-28109.
- // if (replacement) {
- // symbolSupport().renameSymbol(document, adjustedCursor, *replacement,
- // CppEditor::preferLowerCaseFileNames());
- // return;
- // }
+ // Will fix QTCREATORBUG-27978 and QTCREATORBUG-28109 once enabled by default.
+ if (replacement && versionNumber() >= QVersionNumber(16)
+ && Utils::qtcEnvironmentVariableIsSet("QTC_CLANGD_RENAMING")) {
+ symbolSupport().renameSymbol(document, adjustedCursor, *replacement,
+ CppEditor::preferLowerCaseFileNames());
+ return;
+ }
const bool categorize = CppEditor::codeModelSettings()->categorizeFindReferences();