Show qmllint errors on issues pane

Some warning / error messages of qmlsc/qmllint tools were not handled
by any of the output parsers and hence no CompileTask were created to
handle those output, like pushing those warnings into Issues pane. This
was also causing incorrect formatting of CompileOutput messages.This is
not an issue for MsvcParser because there a fallback task is created for
"Error" and "Warning" lines.

Introduce a fallback mechanism in QtParsers to handle qmltooling output
and add test.

Fixes: QTCREATORBUG-28720
Change-Id: I6d0de6bc8b6869c6ea80b72018a4acb7decc8b6d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Semih Yavuz
2023-05-15 14:11:36 +02:00
parent 6243c302d1
commit 114c92acb7

View File

@@ -89,6 +89,21 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
scheduleTask(task, 1);
return {Status::Done, linkSpecs};
}
if (lne.startsWith(QLatin1String("Error:"))) {
constexpr int matchLength = 6;
CompileTask task(Task::TaskType::Error, line.mid(matchLength).trimmed());
scheduleTask(task, 1);
return Status::Done;
}
if (lne.startsWith(QLatin1String("Warning:"))) {
constexpr int matchLength = 8;
CompileTask task(Task::TaskType::Warning, line.mid(matchLength).trimmed());
scheduleTask(task, 1);
return Status::Done;
}
return Status::NotHandled;
}
@@ -205,6 +220,15 @@ void QtSupportPlugin::testQtOutputParser_data()
QLatin1String("dropping duplicate messages"),
Utils::FilePath::fromUserInput(QLatin1String("/some/place/qtcreator_fr.qm")), -1))
<< QString();
QTest::newRow("qmlsc warning") // QTCREATORBUG-28720
<< QString::fromUtf8("Warning: Main.qml:4:1: Warnings occurred while importing module "
"\"QtQuick.Controls\": [import]\"")
<< OutputParserTester::STDERR << QString() << QString()
<< (Tasks() << CompileTask(Task::Warning,
QString::fromUtf8(
"Main.qml:4:1: Warnings occurred while importing module "
"\"QtQuick.Controls\": [import]\"")))
<< QString();
}
void QtSupportPlugin::testQtOutputParser()