forked from qt-creator/qt-creator
Utils: filepathify Link
Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
2
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
2
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
@@ -450,5 +450,5 @@ Utils::Link Symbol::toLink() const
|
||||
if (isGenerated())
|
||||
column = 0;
|
||||
|
||||
return Utils::Link(filename, line, column);
|
||||
return Utils::Link(Utils::FilePath::fromString(filename), line, column);
|
||||
}
|
||||
|
@@ -366,7 +366,9 @@ Utils::Link Location::toLink() const
|
||||
// fromPercentEncoding convert %xx encoding to raw values and then interpret
|
||||
// the result as utf-8, so toUtf8() must be used here.
|
||||
file = QUrl::fromPercentEncoding(file.toUtf8());
|
||||
return Utils::Link(file, range().start().line() + 1, range().start().character());
|
||||
return Utils::Link(Utils::FilePath::fromString(file),
|
||||
range().start().line() + 1,
|
||||
range().start().character());
|
||||
}
|
||||
|
||||
DocumentUri::DocumentUri(const QString &other)
|
||||
|
@@ -25,23 +25,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QString>
|
||||
#include <qmetatype.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Utils {
|
||||
|
||||
struct Link
|
||||
{
|
||||
Link(const QString &fileName = QString(), int line = 0, int column = 0)
|
||||
: targetFileName(fileName)
|
||||
Link(const Utils::FilePath &filePath = Utils::FilePath(), int line = 0, int column = 0)
|
||||
: targetFilePath(filePath)
|
||||
, targetLine(line)
|
||||
, targetColumn(column)
|
||||
{}
|
||||
|
||||
bool hasValidTarget() const
|
||||
{ return !targetFileName.isEmpty(); }
|
||||
{ return !targetFilePath.isEmpty(); }
|
||||
|
||||
bool hasValidLinkText() const
|
||||
{ return linkTextStart != linkTextEnd; }
|
||||
@@ -52,7 +55,7 @@ struct Link
|
||||
int linkTextStart = -1;
|
||||
int linkTextEnd = -1;
|
||||
|
||||
QString targetFileName;
|
||||
Utils::FilePath targetFilePath;
|
||||
int targetLine;
|
||||
int targetColumn;
|
||||
};
|
||||
|
@@ -88,7 +88,7 @@ QVariant CTestTreeItem::data(int column, int role) const
|
||||
return checked();
|
||||
if (role == LinkRole) {
|
||||
QVariant itemLink;
|
||||
itemLink.setValue(Utils::Link(filePath(), line()));
|
||||
itemLink.setValue(Utils::Link(Utils::FilePath::fromString(filePath()), line()));
|
||||
return itemLink;
|
||||
}
|
||||
return ITestTreeItem::data(column, role);
|
||||
|
@@ -267,8 +267,9 @@ void TestNavigationWidget::onItemActivated(const QModelIndex &index)
|
||||
{
|
||||
const Utils::Link link = index.data(LinkRole).value<Utils::Link>();
|
||||
if (link.hasValidTarget()) {
|
||||
Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine,
|
||||
link.targetColumn);
|
||||
Core::EditorManager::openEditorAt(link.targetFilePath,
|
||||
link.targetLine,
|
||||
link.targetColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -137,12 +137,12 @@ bool ITestTreeItem::lessThan(const ITestTreeItem *other, ITestTreeItem::SortMode
|
||||
|
||||
const Utils::Link &leftLink = data(0, LinkRole).value<Utils::Link>();
|
||||
const Utils::Link &rightLink = other->data(0, LinkRole).value<Utils::Link>();
|
||||
if (leftLink.targetFileName == rightLink.targetFileName) {
|
||||
if (leftLink.targetFilePath == rightLink.targetFilePath) {
|
||||
return leftLink.targetLine == rightLink.targetLine
|
||||
? leftLink.targetColumn > rightLink.targetColumn
|
||||
: leftLink.targetLine > rightLink.targetLine;
|
||||
}
|
||||
return leftLink.targetFileName > rightLink.targetFileName;
|
||||
return leftLink.targetFilePath > rightLink.targetFilePath;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -185,7 +185,8 @@ QVariant TestTreeItem::data(int column, int role) const
|
||||
if (type() == GroupNode)
|
||||
return QVariant();
|
||||
QVariant itemLink;
|
||||
itemLink.setValue(Utils::Link(filePath(), line(), int(m_column)));
|
||||
itemLink.setValue(
|
||||
Utils::Link(Utils::FilePath::fromString(filePath()), line(), int(m_column)));
|
||||
return itemLink;
|
||||
}
|
||||
return ITestTreeItem::data(column, role);
|
||||
|
@@ -117,7 +117,7 @@ static Utils::Link linkAtCursor(const QTextCursor &cursor,
|
||||
if (mark.extraInfo.includeDirectivePath && !isValidIncludePathToken(mark))
|
||||
return Link();
|
||||
|
||||
Link token(filePath, mark.line, mark.column);
|
||||
Link token(Utils::FilePath::fromString(filePath), mark.line, mark.column);
|
||||
token.linkTextStart = getMarkPos(cursor, mark);
|
||||
token.linkTextEnd = token.linkTextStart + mark.length;
|
||||
|
||||
@@ -155,8 +155,9 @@ static ::Utils::ProcessLinkCallback extendedCallback(::Utils::ProcessLinkCallbac
|
||||
// If globalFollowSymbol finds nothing follow to the declaration.
|
||||
return [original_callback = std::move(callback), result](const ::Utils::Link &link) {
|
||||
if (link.linkTextStart < 0 && result.isResultOnlyForFallBack) {
|
||||
return original_callback(::Utils::Link(result.fileName, result.startLine,
|
||||
result.startColumn - 1));
|
||||
return original_callback(::Utils::Link(::Utils::FilePath::fromString(result.fileName),
|
||||
result.startLine,
|
||||
result.startColumn - 1));
|
||||
}
|
||||
return original_callback(link);
|
||||
};
|
||||
@@ -243,7 +244,9 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
|
||||
symbolFinder,
|
||||
inNextSplit);
|
||||
} else {
|
||||
callback(Link(result.fileName, result.startLine, result.startColumn - 1));
|
||||
callback(Link(Utils::FilePath::fromString(result.fileName),
|
||||
result.startLine,
|
||||
result.startColumn - 1));
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -162,17 +162,19 @@ QList<Core::LocatorFilterEntry> ClangGlobalSymbolFilter::matchesFor(
|
||||
QList<Core::LocatorFilterEntry> matches = m_cppFilter->matchesFor(future, entry);
|
||||
const QList<Core::LocatorFilterEntry> lspMatches = m_lspFilter->matchesFor(future, entry);
|
||||
if (!lspMatches.isEmpty()) {
|
||||
std::set<std::tuple<QString, int, int>> locations;
|
||||
std::set<std::tuple<Utils::FilePath, int, int>> locations;
|
||||
for (const auto &entry : qAsConst(matches)) {
|
||||
const CppTools::IndexItem::Ptr item
|
||||
= qvariant_cast<CppTools::IndexItem::Ptr>(entry.internalData);
|
||||
locations.insert(std::make_tuple(item->fileName(), item->line(), item->column()));
|
||||
locations.insert(std::make_tuple(Utils::FilePath::fromString(item->fileName()),
|
||||
item->line(),
|
||||
item->column()));
|
||||
}
|
||||
for (const auto &entry : lspMatches) {
|
||||
if (!entry.internalData.canConvert<Utils::Link>())
|
||||
continue;
|
||||
const auto link = qvariant_cast<Utils::Link>(entry.internalData);
|
||||
if (locations.find(std::make_tuple(link.targetFileName, link.targetLine,
|
||||
if (locations.find(std::make_tuple(link.targetFilePath, link.targetLine,
|
||||
link.targetColumn)) == locations.cend()) {
|
||||
matches << entry; // TODO: Insert sorted?
|
||||
}
|
||||
|
@@ -226,7 +226,7 @@ Link OverviewModel::linkFromIndex(const QModelIndex &sourceIndex) const
|
||||
auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
|
||||
if (!item)
|
||||
return {};
|
||||
return Link(m_filePath, item->token.line, item->token.column - 1);
|
||||
return Link(FilePath::fromString(m_filePath), item->token.line, item->token.column - 1);
|
||||
}
|
||||
|
||||
LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIndex) const
|
||||
|
@@ -132,7 +132,7 @@ void RefactoringEngine::globalFollowSymbol(const CppTools::CursorInEditor &data,
|
||||
|
||||
});
|
||||
|
||||
processLinkCallback(Link(usage.path, usage.line, usage.column - 1));
|
||||
processLinkCallback(Link(Utils::FilePath::fromString(usage.path), usage.line, usage.column - 1));
|
||||
}
|
||||
|
||||
bool RefactoringEngine::isRefactoringEngineAvailable() const
|
||||
|
@@ -212,7 +212,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
else
|
||||
return processLinkCallback(link);
|
||||
}
|
||||
link.targetFileName = fileName;
|
||||
link.targetFilePath = Utils::FilePath::fromString(fileName);
|
||||
link.linkTextStart = cursor.position() - positionInBlock + beginPos + 1;
|
||||
link.linkTextEnd = cursor.position() - positionInBlock + endPos;
|
||||
}
|
||||
|
@@ -162,7 +162,7 @@ private:
|
||||
|
||||
Qt::ItemFlags flags(int) const override
|
||||
{
|
||||
Utils::Link link(m_filePath, m_line);
|
||||
const Utils::Link link(Utils::FilePath::fromString(m_filePath), m_line);
|
||||
if (link.hasValidTarget())
|
||||
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
@@ -199,7 +199,7 @@ QVariant CppIncludeHierarchyItem::data(int column, int role) const
|
||||
case Qt::DecorationRole:
|
||||
return FileIconProvider::icon(QFileInfo(m_filePath));
|
||||
case LinkRole:
|
||||
return QVariant::fromValue(Utils::Link(m_filePath, m_line));
|
||||
return QVariant::fromValue(Utils::Link(Utils::FilePath::fromString(m_filePath), m_line));
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@@ -282,7 +282,7 @@ QMimeData *CppIncludeHierarchyModel::mimeData(const QModelIndexList &indexes) co
|
||||
for (const QModelIndex &index : indexes) {
|
||||
auto link = index.data(LinkRole).value<Utils::Link>();
|
||||
if (link.hasValidTarget())
|
||||
data->addFile(link.targetFileName, link.targetLine, link.targetColumn);
|
||||
data->addFile(link.targetFilePath.toString(), link.targetLine, link.targetColumn);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -434,11 +434,11 @@ void CppIncludeHierarchyWidget::perform()
|
||||
if (!m_editor)
|
||||
return;
|
||||
|
||||
QString document = m_editor->textDocument()->filePath().toString();
|
||||
m_model.buildHierarchy(document);
|
||||
const Utils::FilePath documentPath = m_editor->textDocument()->filePath();
|
||||
m_model.buildHierarchy(documentPath.toString());
|
||||
|
||||
m_inspectedFile->setText(m_editor->textDocument()->displayName());
|
||||
m_inspectedFile->setLink(Utils::Link(document));
|
||||
m_inspectedFile->setLink(Utils::Link(documentPath));
|
||||
|
||||
// expand "Includes" and "Included by"
|
||||
m_treeView->expand(m_model.index(0, 0));
|
||||
@@ -465,7 +465,7 @@ void CppIncludeHierarchyWidget::onItemActivated(const QModelIndex &index)
|
||||
{
|
||||
const auto link = index.data(LinkRole).value<Utils::Link>();
|
||||
if (link.hasValidTarget())
|
||||
EditorManager::openEditorAt(link.targetFileName,
|
||||
EditorManager::openEditorAt(link.targetFilePath,
|
||||
link.targetLine,
|
||||
link.targetColumn,
|
||||
Constants::CPPEDITOR_ID);
|
||||
|
@@ -332,11 +332,11 @@ void CppTypeHierarchyWidget::onItemActivated(const QModelIndex &index)
|
||||
return;
|
||||
|
||||
const Link updatedLink = CppElementEvaluator::linkFromExpression(
|
||||
getExpression(index), link.targetFileName);
|
||||
getExpression(index), link.targetFilePath.toString());
|
||||
if (updatedLink.hasValidTarget())
|
||||
link = updatedLink;
|
||||
|
||||
Core::EditorManager::openEditorAt(link.targetFileName,
|
||||
Core::EditorManager::openEditorAt(link.targetFilePath,
|
||||
link.targetLine,
|
||||
link.targetColumn,
|
||||
Constants::CPPEDITOR_ID);
|
||||
@@ -346,7 +346,7 @@ void CppTypeHierarchyWidget::onItemDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
const auto link = index.data(LinkRole).value<Link>();
|
||||
if (link.hasValidTarget())
|
||||
performFromExpression(getExpression(index), link.targetFileName);
|
||||
performFromExpression(getExpression(index), link.targetFilePath.toString());
|
||||
}
|
||||
|
||||
// CppTypeHierarchyFactory
|
||||
@@ -390,7 +390,7 @@ QMimeData *CppTypeHierarchyModel::mimeData(const QModelIndexList &indexes) const
|
||||
foreach (const QModelIndex &index, indexes) {
|
||||
auto link = index.data(LinkRole).value<Link>();
|
||||
if (link.hasValidTarget())
|
||||
data->addFile(link.targetFileName, link.targetLine, link.targetColumn);
|
||||
data->addFile(link.targetFilePath.toString(), link.targetLine, link.targetColumn);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ public:
|
||||
helpCategory = Core::HelpItem::Brief;
|
||||
helpIdCandidates = QStringList(fileName);
|
||||
helpMark = fileName;
|
||||
link = Utils::Link(path);
|
||||
link = Utils::Link(Utils::FilePath::fromString(path));
|
||||
tooltip = path;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
const QString macroName = QString::fromUtf8(macro.name(), macro.name().size());
|
||||
helpIdCandidates = QStringList(macroName);
|
||||
helpMark = macroName;
|
||||
link = Utils::Link(macro.fileName(), macro.line());
|
||||
link = Utils::Link(Utils::FilePath::fromString(macro.fileName()), macro.line());
|
||||
tooltip = macro.toStringWithLineBreaks();
|
||||
}
|
||||
};
|
||||
|
@@ -208,7 +208,7 @@ Link findMacroLink_helper(const QByteArray &name, Document::Ptr doc, const Snaps
|
||||
foreach (const Macro ¯o, doc->definedMacros()) {
|
||||
if (macro.name() == name) {
|
||||
Link link;
|
||||
link.targetFileName = macro.fileName();
|
||||
link.targetFilePath = Utils::FilePath::fromString(macro.fileName());
|
||||
link.targetLine = macro.line();
|
||||
return link;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
const int lineno = cursor.blockNumber() + 1;
|
||||
foreach (const Document::Include &incl, doc->resolvedIncludes()) {
|
||||
if (incl.line() == lineno) {
|
||||
link.targetFileName = incl.resolvedFileName();
|
||||
link.targetFilePath = Utils::FilePath::fromString(incl.resolvedFileName());
|
||||
link.linkTextStart = beginOfToken + 1;
|
||||
link.linkTextEnd = endOfToken - 1;
|
||||
processLinkCallback(link);
|
||||
@@ -671,7 +671,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
editorWidget->showPreProcessorWidget();
|
||||
} else if (fileName != CppModelManager::configurationFileName()) {
|
||||
const Macro ¯o = use->macro();
|
||||
link.targetFileName = macro.fileName();
|
||||
link.targetFilePath = Utils::FilePath::fromString(macro.fileName());
|
||||
link.targetLine = macro.line();
|
||||
link.linkTextStart = use->utf16charsBegin();
|
||||
link.linkTextEnd = use->utf16charsEnd();
|
||||
|
@@ -46,7 +46,7 @@ void VirtualFunctionProposalItem::apply(TextEditor::TextDocumentManipulatorInter
|
||||
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::NoFlags;
|
||||
if (m_openInSplit)
|
||||
flags |= Core::EditorManager::OpenInOtherSplit;
|
||||
Core::EditorManager::openEditorAt(m_link.targetFileName,
|
||||
Core::EditorManager::openEditorAt(m_link.targetFilePath,
|
||||
m_link.targetLine,
|
||||
m_link.targetColumn,
|
||||
CppEditor::Constants::CPPEDITOR_ID,
|
||||
|
@@ -110,7 +110,7 @@ void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
||||
if (!resolveTarget) {
|
||||
QTextCursor linkCursor = cursor;
|
||||
linkCursor.select(QTextCursor::WordUnderCursor);
|
||||
Utils::Link link(document->filePath().toString(),
|
||||
Utils::Link link(document->filePath(),
|
||||
linkCursor.blockNumber() + 1,
|
||||
linkCursor.positionInBlock());
|
||||
link.linkTextStart = linkCursor.selectionStart();
|
||||
|
@@ -195,7 +195,7 @@ void DocumentLocatorFilter::accept(Core::LocatorFilterEntry selection,
|
||||
lineColumn.column);
|
||||
} else if (selection.internalData.canConvert<Utils::Link>()) {
|
||||
auto link = qvariant_cast<Utils::Link>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn);
|
||||
Core::EditorManager::openEditorAt(link.targetFilePath, link.targetLine, link.targetColumn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void WorkspaceLocatorFilter::accept(Core::LocatorFilterEntry selection,
|
||||
{
|
||||
if (selection.internalData.canConvert<Utils::Link>()) {
|
||||
auto link = qvariant_cast<Utils::Link>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn);
|
||||
Core::EditorManager::openEditorAt(link.targetFilePath, link.targetLine, link.targetColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -105,5 +105,5 @@ void NimTextEditorWidget::onFindLinkFinished()
|
||||
}
|
||||
|
||||
const Line &line = m_request->lines().front();
|
||||
m_callback(Utils::Link{line.abs_path, line.row, line.column});
|
||||
m_callback(Utils::Link{Utils::FilePath::fromString(line.abs_path), line.row, line.column});
|
||||
}
|
||||
|
@@ -238,11 +238,11 @@ void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
else
|
||||
return processLinkCallback(link);
|
||||
}
|
||||
link.targetFileName = QDir::cleanPath(fileName);
|
||||
link.targetFilePath = Utils::FilePath::fromString(QDir::cleanPath(fileName));
|
||||
} else {
|
||||
link.targetFileName = checkForPrfFile(buffer);
|
||||
link.targetFilePath = Utils::FilePath::fromString(checkForPrfFile(buffer));
|
||||
}
|
||||
if (!link.targetFileName.isEmpty()) {
|
||||
if (!link.targetFilePath.isEmpty()) {
|
||||
link.linkTextStart = cursor.position() - positionInBlock + beginPos + 1;
|
||||
link.linkTextEnd = cursor.position() - positionInBlock + endPos;
|
||||
}
|
||||
|
@@ -772,7 +772,7 @@ void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
// if it's a file import, link to the file
|
||||
foreach (const ImportInfo &import, semanticInfo.document->bind()->imports()) {
|
||||
if (import.ast() == importAst && import.type() == ImportType::File) {
|
||||
Utils::Link link(import.path());
|
||||
Utils::Link link(Utils::FilePath::fromString(import.path()));
|
||||
link.linkTextStart = importAst->firstSourceLocation().begin();
|
||||
link.linkTextEnd = importAst->lastSourceLocation().end();
|
||||
processLinkCallback(Utils::Link());
|
||||
@@ -790,7 +790,7 @@ void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
link.linkTextStart = literal->literalToken.begin();
|
||||
link.linkTextEnd = literal->literalToken.end();
|
||||
if (semanticInfo.snapshot.document(text)) {
|
||||
link.targetFileName = text;
|
||||
link.targetFilePath = Utils::FilePath::fromString(text);
|
||||
processLinkCallback(link);
|
||||
return;
|
||||
}
|
||||
@@ -798,7 +798,7 @@ void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
semanticInfo.document->path(),
|
||||
text);
|
||||
if (QFileInfo::exists(relative)) {
|
||||
link.targetFileName = relative;
|
||||
link.targetFilePath = Utils::FilePath::fromString(relative);
|
||||
processLinkCallback(link);
|
||||
return;
|
||||
}
|
||||
@@ -815,7 +815,7 @@ void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
return processLinkCallback(Utils::Link());
|
||||
|
||||
Utils::Link link;
|
||||
link.targetFileName = fileName;
|
||||
link.targetFilePath = Utils::FilePath::fromString(fileName);
|
||||
link.targetLine = line;
|
||||
link.targetColumn = column - 1; // adjust the column
|
||||
|
||||
|
@@ -6244,7 +6244,7 @@ bool TextEditorWidget::openLink(const Utils::Link &link, bool inNextSplit)
|
||||
if (!link.hasValidTarget())
|
||||
return false;
|
||||
|
||||
if (!inNextSplit && textDocument()->filePath().toString() == link.targetFileName) {
|
||||
if (!inNextSplit && textDocument()->filePath() == link.targetFilePath) {
|
||||
EditorManager::addCurrentPositionToNavigationHistory();
|
||||
gotoLine(link.targetLine, link.targetColumn, true, true);
|
||||
setFocus();
|
||||
@@ -6254,8 +6254,11 @@ bool TextEditorWidget::openLink(const Utils::Link &link, bool inNextSplit)
|
||||
if (inNextSplit)
|
||||
flags |= EditorManager::OpenInOtherSplit;
|
||||
|
||||
return EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn,
|
||||
Id(), flags);
|
||||
return EditorManager::openEditorAt(link.targetFilePath,
|
||||
link.targetLine,
|
||||
link.targetColumn,
|
||||
Id(),
|
||||
flags);
|
||||
}
|
||||
|
||||
bool TextEditorWidgetPrivate::isMouseNavigationEvent(QMouseEvent *e) const
|
||||
@@ -8670,7 +8673,7 @@ void TextEditorLinkLabel::mouseMoveEvent(QMouseEvent *event)
|
||||
return;
|
||||
|
||||
auto data = new DropMimeData;
|
||||
data->addFile(m_link.targetFileName, m_link.targetLine, m_link.targetColumn);
|
||||
data->addFile(m_link.targetFilePath.toString(), m_link.targetLine, m_link.targetColumn);
|
||||
auto drag = new QDrag(this);
|
||||
drag->setMimeData(data);
|
||||
drag->exec(Qt::CopyAction);
|
||||
@@ -8682,7 +8685,9 @@ void TextEditorLinkLabel::mouseReleaseEvent(QMouseEvent *event)
|
||||
if (!m_link.hasValidTarget())
|
||||
return;
|
||||
|
||||
EditorManager::openEditorAt(m_link.targetFileName, m_link.targetLine, m_link.targetColumn);
|
||||
EditorManager::openEditorAt(m_link.targetFilePath.toString(),
|
||||
m_link.targetLine,
|
||||
m_link.targetColumn);
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -189,8 +189,8 @@ std::ostream &operator<<(std::ostream &out, const LineColumn &lineColumn)
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Link &link)
|
||||
{
|
||||
return out << "(" << link.targetFileName << ", " << link.targetLine << ", " << link.targetColumn
|
||||
<< ", " << link.linkTextStart << ", " << link.linkTextEnd << ")";
|
||||
return out << "(" << link.targetFilePath.toString() << ", " << link.targetLine << ", "
|
||||
<< link.targetColumn << ", " << link.linkTextStart << ", " << link.linkTextEnd << ")";
|
||||
}
|
||||
|
||||
const char * toText(Utils::Language language)
|
||||
|
@@ -155,7 +155,7 @@ TEST_F(RefactoringEngine, InGlobalFollowSymbol)
|
||||
ON_CALL(mockSymbolQuery, declarationsAt(Eq(12), 2, 5)).WillByDefault(Return(usages));
|
||||
|
||||
EXPECT_CALL(mockCallback,
|
||||
Call(AllOf(Field(&Link::targetFileName, Eq("/path1")),
|
||||
Call(AllOf(Field(&Link::targetFilePath, Eq(Utils::FilePath::fromString("/path1"))),
|
||||
Field(&Link::targetLine, Eq(1)),
|
||||
Field(&Link::targetColumn, Eq(2)))));
|
||||
|
||||
@@ -171,7 +171,7 @@ TEST_F(RefactoringEngine, InGlobalFollowSymbolSkipCurrentFile)
|
||||
ON_CALL(mockSymbolQuery, declarationsAt(Eq(12), 2, 5)).WillByDefault(Return(usages));
|
||||
|
||||
EXPECT_CALL(mockCallback,
|
||||
Call(AllOf(Field(&Link::targetFileName, Eq("/path2")),
|
||||
Call(AllOf(Field(&Link::targetFilePath, Eq(Utils::FilePath::fromString("/path2"))),
|
||||
Field(&Link::targetLine, Eq(4)),
|
||||
Field(&Link::targetColumn, Eq(4)))));
|
||||
|
||||
|
Reference in New Issue
Block a user