Utils: filepathify Link

Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2021-05-25 10:11:31 +02:00
parent dbd4a10d6f
commit 356bfcc9fd
24 changed files with 76 additions and 59 deletions

View File

@@ -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