forked from qt-creator/qt-creator
qmljs: delay import scan until at least one qml file is parsed
Task-number: QTCREATORBUG-10899 Change-Id: I5dca739a89434c7b5813c7a79a76ab7c22e3d71d Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -232,6 +232,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
|
|||||||
|
|
||||||
ModelManager::ModelManager(QObject *parent):
|
ModelManager::ModelManager(QObject *parent):
|
||||||
ModelManagerInterface(parent),
|
ModelManagerInterface(parent),
|
||||||
|
m_shouldScanImports(false),
|
||||||
m_pluginDumper(new PluginDumper(this))
|
m_pluginDumper(new PluginDumper(this))
|
||||||
{
|
{
|
||||||
m_synchronizer.setCancelOnWait(true);
|
m_synchronizer.setCancelOnWait(true);
|
||||||
@@ -380,6 +381,20 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
|
|||||||
if (sourceFiles.count() > 1)
|
if (sourceFiles.count() > 1)
|
||||||
ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1113,6 +1128,8 @@ void ModelManager::updateImportPaths()
|
|||||||
|
|
||||||
updateSourceFiles(importedFiles, true);
|
updateSourceFiles(importedFiles, true);
|
||||||
|
|
||||||
|
if (!m_shouldScanImports)
|
||||||
|
return;
|
||||||
QStringList pathToScan;
|
QStringList pathToScan;
|
||||||
{
|
{
|
||||||
QMutexLocker l(&m_mutex);
|
QMutexLocker l(&m_mutex);
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ private:
|
|||||||
QmlJS::QmlLanguageBundles m_activeBundles;
|
QmlJS::QmlLanguageBundles m_activeBundles;
|
||||||
QmlJS::QmlLanguageBundles m_extendedBundles;
|
QmlJS::QmlLanguageBundles m_extendedBundles;
|
||||||
QmlJS::ViewerContext m_vContext;
|
QmlJS::ViewerContext m_vContext;
|
||||||
|
bool m_shouldScanImports;
|
||||||
QSet<QString> m_scannedPaths;
|
QSet<QString> m_scannedPaths;
|
||||||
|
|
||||||
QTimer *m_updateCppQmlTypesTimer;
|
QTimer *m_updateCppQmlTypesTimer;
|
||||||
|
|||||||
Reference in New Issue
Block a user