forked from qt-creator/qt-creator
Clang: add globalFollowSymbol to RefactoringEngine
Allows to follow outside of current TU. Change-Id: Ieea2fd72bfdf6d60a988b40efcf2f41c5a71d045 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <clangsupport/filepathcachinginterface.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
#include <QTextCursor>
|
||||
@@ -115,6 +116,24 @@ void RefactoringEngine::findUsages(const CppTools::CursorInEditor &data,
|
||||
showUsagesCallback(locationsAt(data));
|
||||
}
|
||||
|
||||
RefactoringEngine::Link RefactoringEngine::globalFollowSymbol(const CppTools::CursorInEditor &data,
|
||||
const CPlusPlus::Snapshot &,
|
||||
const CPlusPlus::Document::Ptr &,
|
||||
CppTools::SymbolFinder *,
|
||||
bool) const
|
||||
{
|
||||
// TODO: replace that with specific followSymbol query
|
||||
const CppTools::Usages usages = locationsAt(data);
|
||||
CppTools::Usage usage = Utils::findOrDefault(usages, [&data](const CppTools::Usage &usage) {
|
||||
// We've already searched in the current file, skip it.
|
||||
if (usage.path == data.filePath().toString())
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
return Link(usage.path, usage.line, usage.column);
|
||||
}
|
||||
|
||||
bool RefactoringEngine::isRefactoringEngineAvailable() const
|
||||
{
|
||||
return m_server.isAvailable();
|
||||
|
||||
Reference in New Issue
Block a user