Commit 4ea1871a authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

qmljs: delay import scan until at least one qml file is parsed



Task-number: QTCREATORBUG-10899
Change-Id: I5dca739a89434c7b5813c7a79a76ab7c22e3d71d
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 284fd9f1
......@@ -232,6 +232,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
ModelManager::ModelManager(QObject *parent):
ModelManagerInterface(parent),
m_shouldScanImports(false),
m_pluginDumper(new PluginDumper(this))
{
m_synchronizer.setCancelOnWait(true);
......@@ -380,6 +381,20 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
if (sourceFiles.count() > 1)
ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX);
if (sourceFiles.count() > 1 && !m_shouldScanImports) {
bool scan = false;
{
QMutexLocker l(&m_mutex);
if (!m_shouldScanImports) {
m_shouldScanImports = true;
scan = true;
}
}
if (scan)
updateImportPaths();
}
return result;
}
......@@ -1113,6 +1128,8 @@ void ModelManager::updateImportPaths()
updateSourceFiles(importedFiles, true);
if (!m_shouldScanImports)
return;
QStringList pathToScan;
{
QMutexLocker l(&m_mutex);
......
......@@ -179,6 +179,7 @@ private:
QmlJS::QmlLanguageBundles m_activeBundles;
QmlJS::QmlLanguageBundles m_extendedBundles;
QmlJS::ViewerContext m_vContext;
bool m_shouldScanImports;
QSet<QString> m_scannedPaths;
QTimer *m_updateCppQmlTypesTimer;
......
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