Commit a53583d5 authored by Kai Koehne's avatar Kai Koehne
Browse files

ApplicationOutput: Also linkify qml errors without column.

I didn't manage to find one regular expression that matches both lines with and
without column correctly. Instead use two distinct ones ...

Task-number: QTCREATORBUG-3022
parent d467d0e2
......@@ -42,7 +42,10 @@ using namespace Qt4ProjectManager;
QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project)
: OutputFormatter()
, m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):"))
, m_qmlError(QLatin1String("^(file:///.+" // file url
":\\d+" // colon, line
"(?::\\d+)?)" // colon, column (optional)
":")) // colon
, m_qtError(QLatin1String("Object::.*in (.*:\\d+)"))
, m_qtAssert(QLatin1String("^ASSERT: .* in file (.+, line \\d+)$"))
, m_qtTestFail(QLatin1String("^ Loc: \\[(.*)\\]$"))
......@@ -176,16 +179,28 @@ void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr, const QSt
void QtOutputFormatter::handleLink(const QString &href)
{
if (!href.isEmpty()) {
const QRegExp qmlErrorLink(QLatin1String("^(file:///.+):(\\d+):(\\d+)"));
if (qmlErrorLink.indexIn(href) != -1) {
const QString fileName = QUrl(qmlErrorLink.cap(1)).toLocalFile();
const int line = qmlErrorLink.cap(2).toInt();
const int column = qmlErrorLink.cap(3).toInt();
const QRegExp qmlLineColumnLink(QLatin1String("^(file:///.+)" // file url
":(\\d+)" // line
":(\\d+)$")); // column
if (qmlLineColumnLink.indexIn(href) != -1) {
const QString fileName = QUrl(qmlLineColumnLink.cap(1)).toLocalFile();
const int line = qmlLineColumnLink.cap(2).toInt();
const int column = qmlLineColumnLink.cap(3).toInt();
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column - 1);
return;
}
const QRegExp qmlLineLink(QLatin1String("^(file:///.+)" // file url
":(\\d+)$")); // line
if (qmlLineLink.indexIn(href) != -1) {
const QString fileName = QUrl(qmlLineLink.cap(1)).toLocalFile();
const int line = qmlLineLink.cap(2).toInt();
TextEditor::BaseTextEditor::openEditorAt(fileName, line);
return;
}
QString fileName;
int line = -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment