forked from qt-creator/qt-creator
Clangd: do not modify the default replacement string
Fixes: QTCREATORBUG-28321 Fixes: QTCREATORBUG-28910 Change-Id: I4cfaf5ea3916a0ecbf0b0bae4d0c231513671c73 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
@@ -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;
|
||||
|
@@ -549,8 +549,11 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search,
|
||||
const std::optional<PrepareRenameRequest::Response::Error> &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<WorkspaceEdit> &edits = response.result();
|
||||
|
Reference in New Issue
Block a user