QmlJS: Fix semantic and non-semantic QML error reporting.

The QML snapshot only ever contains valid Documents; to compile a list
of parser problems we need to get at the invalid documents.

To do that, the model manager now provides a Snapshot with up to date,
but potentially invalid documents. That should also be useful for other
things.

Change-Id: I67892f63771c221bf2fe2c2bf0240a0f4e523227
Reviewed-on: http://codereview.qt.nokia.com/3012
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-08-16 14:11:30 +02:00
parent ede672c8d9
commit f725c24c56
7 changed files with 36 additions and 30 deletions

View File

@@ -119,7 +119,8 @@ void QmlTaskManager::collectMessages(
fileName, Constants::TASK_CATEGORY_QML_ANALYSIS);
}
future.reportResult(result);
if (!result.tasks.isEmpty())
future.reportResult(result);
if (future.isCanceled())
break;
}
@@ -145,16 +146,15 @@ void QmlTaskManager::updateMessagesNow(bool updateSemantic)
// abort any update that's going on already
m_messageCollector.cancel();
removeAllTasks();
removeAllTasks(updateSemantic);
// collect all the source files in open projects
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
// process them
QFuture<FileErrorMessages> future =
QtConcurrent::run<FileErrorMessages>(
&collectMessages, modelManager->snapshot(), modelManager->projectInfos(),
modelManager->importPaths(), !updateSemantic);
&collectMessages, modelManager->snapshot(false), modelManager->projectInfos(),
modelManager->importPaths(), updateSemantic);
m_messageCollector.setFuture(future);
}
@@ -198,14 +198,11 @@ void QmlTaskManager::removeTasksForFile(const QString &fileName)
}
}
void QmlTaskManager::removeAllTasks()
void QmlTaskManager::removeAllTasks(bool clearSemantic)
{
QMapIterator<QString, QList<ProjectExplorer::Task> > it(m_docsWithTasks);
while (it.hasNext()) {
it.next();
foreach (const ProjectExplorer::Task &task, it.value())
m_taskHub->removeTask(task);
}
m_taskHub->clearTasks(Constants::TASK_CATEGORY_QML);
if (clearSemantic)
m_taskHub->clearTasks(Constants::TASK_CATEGORY_QML_ANALYSIS);
m_docsWithTasks.clear();
}