From 4d688c932baa41e9c4d04084bd4ce682301f7a48 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 11 Oct 2022 10:49:34 +0200 Subject: [PATCH] Clangd: do not modify the default replacement string Fixes: QTCREATORBUG-28321 Fixes: QTCREATORBUG-28910 Change-Id: I4cfaf5ea3916a0ecbf0b0bae4d0c231513671c73 Reviewed-by: Christian Kandeler Reviewed-by: Reviewed-by: Leena Miettinen --- src/plugins/clangcodemodel/clangdclient.cpp | 2 -- src/plugins/languageclient/languageclientsymbolsupport.cpp | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 392a6a1ffe8..9fa2e792ab6 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -370,8 +370,6 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c setActivateDocumentAutomatically(true); setCompletionAssistProvider(new ClangdCompletionAssistProvider(this)); setQuickFixAssistProvider(new ClangdQuickFixProvider(this)); - symbolSupport().setDefaultRenamingSymbolMapper( - [](const QString &oldSymbol) { return oldSymbol + "_new"; }); symbolSupport().setLimitRenamingToProjects(true); if (!project) { QJsonObject initOptions; diff --git a/src/plugins/languageclient/languageclientsymbolsupport.cpp b/src/plugins/languageclient/languageclientsymbolsupport.cpp index 995ca770f3d..b5f301d4433 100644 --- a/src/plugins/languageclient/languageclientsymbolsupport.cpp +++ b/src/plugins/languageclient/languageclientsymbolsupport.cpp @@ -549,8 +549,11 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search, const std::optional &error = response.error(); QString errorMessage; if (error.has_value()) { - m_client->log(*error); errorMessage = error->toString(); + if (errorMessage.contains("Cannot rename symbol: new name is the same as the old name")) + errorMessage = Tr::tr("Start typing to see replacements"); // clangd optimization + else + m_client->log(*error); } const std::optional &edits = response.result();