From 97a97b3019bcab74e8c4aae766e2992fed389fa0 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 12 Jun 2023 09:01:12 +0200 Subject: [PATCH] QmlJS: Fix initializing static analyzer ...when using a customized analyzer that has no customization. If there is no customization we do not store the value inside the settings, so we get empty lists instead of the default lists for disabled messages. Amends 427640063e2d95752e95b17af13b8ed3e0e4473a. Change-Id: Idea560176b0a9caa93dca7a3a2d01cc3aa3a6d2f Reviewed-by: Alessandro Portale --- src/libs/qmljs/qmljscheck.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 78d93fb6c5d..2a41f472d7b 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -697,12 +697,19 @@ Check::Check(Document::Ptr doc, const ContextPtr &context, Utils::QtcSettings *q _enabledMessages = Utils::toSet(Message::allMessageTypes()); if (qtcSettings && qtcSettings->value("J.QtQuick/QmlJSEditor.useCustomAnalyzer").toBool()) { - auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessages").toList(); + auto toIntList = [](const QList list) { + return Utils::transform(list, [](StaticAnalysis::Type t) { return int(t); }); + }; + auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessages", + QVariant::fromValue( + toIntList(defaultDisabledMessages()))).toList(); for (const QVariant &disabledNumber : disabled) disableMessage(StaticAnalysis::Type(disabledNumber.toInt())); if (!isQtQuick2Ui()) { - auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessagesNonQuickUI").toList(); + auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessagesNonQuickUI", + QVariant::fromValue( + toIntList(defaultDisabledMessagesForNonQuickUi()))).toList(); for (const QVariant &disabledNumber : disabled) disableMessage(StaticAnalysis::Type(disabledNumber.toInt())); }