Clang: Follow symbol with Ctrl+click on invalid cursors

When cursor is invalid try to follow it with built-in
code model and highlight the token in case of success.

Fixes: QTCREATORBUG-21637
Change-Id: I4c765882817fa150a155074c9d71beceb5905af8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-02-22 12:01:04 +01:00
parent 1886c5e19b
commit 0a3aa12962

View File

@@ -28,6 +28,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppfollowsymbolundercursor.h>
#include <texteditor/texteditor.h>
#include <clangsupport/tokeninfocontainer.h>
@@ -183,12 +184,22 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
return processLinkCallback(Utils::Link());
if (!resolveTarget) {
processLinkCallback(linkAtCursor(cursor,
Utils::Link link = linkAtCursor(cursor,
data.filePath().toString(),
static_cast<uint>(line),
static_cast<uint>(column),
processor));
return;
processor);
if (link == Utils::Link()) {
CppTools::FollowSymbolUnderCursor followSymbol;
return followSymbol.findLink(data,
std::move(processLinkCallback),
false,
snapshot,
documentFromSemanticInfo,
symbolFinder,
inNextSplit);
}
return processLinkCallback(link);
}
QFuture<CppTools::SymbolInfo> infoFuture