From 6ffe16d90b6e94b83dcde880846c20713ebe3817 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 19 May 2021 14:22:10 +0200 Subject: [PATCH] ClangCodeModel: Use clangd for all "follow symbol" actions Change-Id: I4e33342d9683c24ad6ea5fbb578a1b460790aa4d Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangfollowsymbol.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp index a6d856b2013..221c59aae63 100644 --- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp +++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp @@ -23,9 +23,12 @@ ** ****************************************************************************/ -#include "clangeditordocumentprocessor.h" #include "clangfollowsymbol.h" +#include "clangdclient.h" +#include "clangeditordocumentprocessor.h" +#include "clangmodelmanagersupport.h" + #include #include #include @@ -173,6 +176,16 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data, CppTools::SymbolFinder *symbolFinder, bool inNextSplit) { + ClangdClient * const client + = ClangModelManagerSupport::instance()->clientForFile(data.filePath()); + if (client && client->isFullyIndexed()) { + QTC_ASSERT(client->documentOpen(data.textDocument()), + client->openDocument(data.textDocument())); + client->symbolSupport().findLinkAt(data.textDocument(), data.cursor(), + std::move(processLinkCallback), resolveTarget); + return; + } + int line = 0; int column = 0; QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor());