ClangCodeModel: Implement global "follow symbol" via clangd

Change-Id: Iaa58e3ee2e74b1a1210850f944df942e3669d247
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-05-19 11:12:07 +02:00
parent 2531233747
commit b087897b42
4 changed files with 38 additions and 16 deletions

View File

@@ -119,5 +119,28 @@ void RefactoringEngine::findUsages(const CppTools::CursorInEditor &cursor,
client->findUsages(cursor.textDocument(), cursor.cursor(), {});
}
void RefactoringEngine::globalFollowSymbol(
const CppTools::CursorInEditor &cursor,
Utils::ProcessLinkCallback &&callback,
const CPlusPlus::Snapshot &snapshot,
const CPlusPlus::Document::Ptr &doc,
CppTools::SymbolFinder *symbolFinder,
bool inNextSplit) const
{
ProjectExplorer::Project * const project
= ProjectExplorer::SessionManager::projectForFile(cursor.filePath());
ClangdClient * const client = ClangModelManagerSupport::instance()->clientForProject(project);
if (!client || !client->isFullyIndexed()) {
CppTools::CppModelManager::builtinRefactoringEngine()
->globalFollowSymbol(cursor, std::move(callback), snapshot, doc, symbolFinder,
inNextSplit);
return;
}
QTC_ASSERT(client->documentOpen(cursor.textDocument()),
client->openDocument(cursor.textDocument()));
client->symbolSupport().findLinkAt(cursor.textDocument(), cursor.cursor(), std::move(callback),
true);
}
} // namespace Internal
} // namespace ClangCodeModel