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>
This commit is contained in:
Christian Kandeler
2022-10-21 16:29:56 +02:00
parent 16261ad472
commit a459ee5d24

View File

@@ -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();