From 114c92acb7d9bc0ff765718d6029a8c2dc7c1a49 Mon Sep 17 00:00:00 2001 From: Semih Yavuz Date: Mon, 15 May 2023 14:11:36 +0200 Subject: [PATCH] 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 --- src/plugins/qtsupport/qtparser.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp index 25ab3604828..2708b19c5e6 100644 --- a/src/plugins/qtsupport/qtparser.cpp +++ b/src/plugins/qtsupport/qtparser.cpp @@ -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()