Commit ef42f53f authored by Fawzi Mohamed's avatar Fawzi Mohamed

qmljs: do not show warnings for not fully supported languages

Change-Id: Ie153caefcbb0f5d6d627697fd324d0cd0e3fa31f
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent c933d423
......@@ -98,6 +98,24 @@ bool Document::isQmlLikeLanguage(Document::Language language)
}
}
bool Document::isFullySupportedLanguage(Document::Language language)
{
switch (language) {
case JavaScriptLanguage:
case JsonLanguage:
case QmlLanguage:
case QmlQtQuick1Language:
case QmlQtQuick2Language:
return true;
case UnknownLanguage:
case QmlQbsLanguage:
case QmlProjectLanguage:
case QmlTypeInfoLanguage:
break;
}
return false;
}
Document::Document(const QString &fileName, Language language)
: _engine(0)
, _ast(0)
......
......@@ -65,6 +65,7 @@ public:
};
static bool isQmlLikeLanguage(Language languge);
static bool isFullySupportedLanguage(Language language);
protected:
Document(const QString &fileName, Language language);
......
......@@ -667,11 +667,13 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
m_futureSemanticInfoRevision = doc->editorRevision();
m_semanticInfoUpdater->update(doc, m_modelManager->snapshot());
setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>());
} else {
} else if (Document::isFullySupportedLanguage(doc->language())) {
// show parsing errors
QList<QTextEdit::ExtraSelection> selections;
appendExtraSelectionsForMessages(&selections, doc->diagnosticMessages(), document());
setExtraSelections(CodeWarningsSelection, selections);
} else {
setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>());
}
}
......
......@@ -429,17 +429,20 @@ protected:
private:
void run()
{
int nMessages = m_scopeChain.document()->diagnosticMessages().size()
+ m_semanticInfo.semanticMessages.size()
+ m_semanticInfo.staticAnalysisMessages.size();
m_delayedUses.reserve(nMessages);
m_diagnosticRanges.reserve(nMessages);
m_extraFormats.reserve(nMessages);
addMessages(m_scopeChain.document()->diagnosticMessages(), m_scopeChain.document());
addMessages(m_semanticInfo.semanticMessages, m_semanticInfo.document);
addMessages(m_semanticInfo.staticAnalysisMessages, m_semanticInfo.document);
qSort(m_delayedUses.begin(), m_delayedUses.end(), sortByLinePredicate);
int nMessages = 0;
if (Document::isFullySupportedLanguage(m_scopeChain.document()->language())) {
nMessages = m_scopeChain.document()->diagnosticMessages().size()
+ m_semanticInfo.semanticMessages.size()
+ m_semanticInfo.staticAnalysisMessages.size();
m_delayedUses.reserve(nMessages);
m_diagnosticRanges.reserve(nMessages);
m_extraFormats.reserve(nMessages);
addMessages(m_scopeChain.document()->diagnosticMessages(), m_scopeChain.document());
addMessages(m_semanticInfo.semanticMessages, m_semanticInfo.document);
addMessages(m_semanticInfo.staticAnalysisMessages, m_semanticInfo.document);
qSort(m_delayedUses.begin(), m_delayedUses.end(), sortByLinePredicate);
}
m_currentDelayedUse = 0;
m_semanticHighlighter.reportMessagesInfo(m_diagnosticRanges, m_extraFormats);
......
......@@ -112,19 +112,21 @@ void QmlTaskManager::collectMessages(
FileErrorMessages result;
result.fileName = fileName;
result.tasks = convertToTasks(document->diagnosticMessages(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML));
if (updateSemantic) {
result.tasks += convertToTasks(linkMessages.value(fileName),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
Check checker(document, context);
result.tasks += convertToTasks(checker(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
if (Document::isFullySupportedLanguage(document->language())) {
result.tasks = convertToTasks(document->diagnosticMessages(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML));
if (updateSemantic) {
result.tasks += convertToTasks(linkMessages.value(fileName),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
Check checker(document, context);
result.tasks += convertToTasks(checker(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML_ANALYSIS));
}
}
if (!result.tasks.isEmpty())
......
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