forked from qt-creator/qt-creator
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:
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
|
#include <cpptools/cppfollowsymbolundercursor.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <clangsupport/tokeninfocontainer.h>
|
#include <clangsupport/tokeninfocontainer.h>
|
||||||
@@ -183,12 +184,22 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
|
|||||||
return processLinkCallback(Utils::Link());
|
return processLinkCallback(Utils::Link());
|
||||||
|
|
||||||
if (!resolveTarget) {
|
if (!resolveTarget) {
|
||||||
processLinkCallback(linkAtCursor(cursor,
|
Utils::Link link = linkAtCursor(cursor,
|
||||||
data.filePath().toString(),
|
data.filePath().toString(),
|
||||||
static_cast<uint>(line),
|
static_cast<uint>(line),
|
||||||
static_cast<uint>(column),
|
static_cast<uint>(column),
|
||||||
processor));
|
processor);
|
||||||
return;
|
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
|
QFuture<CppTools::SymbolInfo> infoFuture
|
||||||
|
Reference in New Issue
Block a user