ClangCodeModel: Do not try to rename macros and namespaces with clangd

Unfortunately, clangd refuses to rename macros and namespaces.
Fall back to our old two-stage "find + replace" approach for macros
(which clangd can find just fine) and employ the built-in code model for
namespaces (as they don't get indexed at all by clangd).

Change-Id: I08b1088ff4de9220427e089ef0700dbf2a944081
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2023-04-03 14:12:39 +02:00
parent 6ad3531b15
commit 0319542937
4 changed files with 51 additions and 15 deletions

View File

@@ -320,7 +320,7 @@ void ClangModelManagerSupport::globalRename(const CppEditor::CursorInEditor &cur
client && client->isFullyIndexed()) {
QTC_ASSERT(client->documentOpen(cursor.textDocument()),
client->openDocument(cursor.textDocument()));
client->findUsages(cursor.textDocument(), cursor.cursor(), replacement, callback);
client->findUsages(cursor, replacement, callback);
return;
}
CppModelManager::globalRename(cursor, replacement, callback, CppModelManager::Backend::Builtin);
@@ -332,8 +332,7 @@ void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &curso
client && client->isFullyIndexed()) {
QTC_ASSERT(client->documentOpen(cursor.textDocument()),
client->openDocument(cursor.textDocument()));
client->findUsages(cursor.textDocument(), cursor.cursor(), {}, {});
client->findUsages(cursor, {}, {});
return;
}
CppModelManager::findUsages(cursor, CppModelManager::Backend::Builtin);