ClangCodeModel: Implement declaration/definition switch via clangd

Change-Id: I522a415d76fbc5332e5cc1fdfd2d7ab19cb9ed64
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-05-31 15:57:44 +02:00
parent de6c7696d2
commit 41dafc8132
11 changed files with 392 additions and 80 deletions

View File

@@ -251,5 +251,23 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
m_watcher->setFuture(infoFuture);
}
void ClangFollowSymbol::switchDeclDef(const CppTools::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
const CPlusPlus::Snapshot &snapshot,
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
CppTools::SymbolFinder *symbolFinder)
{
ClangdClient * const client
= ClangModelManagerSupport::instance()->clientForFile(data.filePath());
if (client && client->isFullyIndexed() && client->versionNumber() >= QVersionNumber(13)) {
client->switchDeclDef(data.textDocument(), data.cursor(), data.editorWidget(),
std::move(processLinkCallback));
return;
}
CppTools::CppModelManager::builtinFollowSymbol().switchDeclDef(
data, std::move(processLinkCallback), snapshot, documentFromSemanticInfo,
symbolFinder);
}
} // namespace Internal
} // namespace ClangCodeModel