diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 3c3c3b53360..577fbf4b2b1 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -990,7 +990,7 @@ struct ScanItem { void ModelManagerInterface::importScan(QFutureInterface &future, ModelManagerInterface::WorkingCopy workingCopy, PathsAndLanguages paths, ModelManagerInterface *modelManager, - bool emitDocChangedOnDisk, bool libOnly) + bool emitDocChangedOnDisk, bool libOnly, bool forceRescan) { // paths we have scanned for files and added to the files list QSet scannedPaths; @@ -1008,7 +1008,7 @@ void ModelManagerInterface::importScan(QFutureInterface &future, for (int i = 0; i < paths.size(); ++i) { PathAndLanguage pAndL = paths.at(i); QString cPath = QDir::cleanPath(pAndL.path().toString()); - if (modelManager->m_scannedPaths.contains(cPath)) + if (!forceRescan && modelManager->m_scannedPaths.contains(cPath)) continue; pathsToScan.append(ScanItem(cPath, 0, pAndL.language())); modelManager->m_scannedPaths.insert(cPath); @@ -1024,13 +1024,15 @@ void ModelManagerInterface::importScan(QFutureInterface &future, ScanItem toScan = pathsToScan.last(); pathsToScan.pop_back(); int pathBudget = (1 << (maxScanDepth + 2 - toScan.depth)); - if (!scannedPaths.contains(toScan.path)) { + if (forceRescan || !scannedPaths.contains(toScan.path)) { QStringList importedFiles; - if (!findNewQmlLibraryInPath(toScan.path, snapshot, modelManager, &importedFiles, + if (forceRescan || + (!findNewQmlLibraryInPath(toScan.path, snapshot, modelManager, &importedFiles, &scannedPaths, &newLibraries, true) - && !libOnly && snapshot.documentsInDirectory(toScan.path).isEmpty()) + && !libOnly && snapshot.documentsInDirectory(toScan.path).isEmpty())) { importedFiles += filesInDirectoryForLanguages(toScan.path, toScan.language.companionLanguages()); + } workDone += 1; future.setProgressValue(progressRange * workDone / totalWork); if (!importedFiles.isEmpty()) { @@ -1101,7 +1103,7 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths) if (pathToScan.length() > 1) { QFuture result = Utils::runAsync(&ModelManagerInterface::importScan, workingCopyInternal(), pathToScan, - this, true, true); + this, true, true, false); cleanupFutures(); m_futures.append(result); diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index b602ebb1169..193bd5b2d35 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -205,7 +205,7 @@ public: WorkingCopy workingCopyInternal, PathsAndLanguages paths, ModelManagerInterface *modelManager, - bool emitDocChangedOnDisk, bool libOnly = true); + bool emitDocChangedOnDisk, bool libOnly = true, bool forceRescan = false); virtual void resetCodeModel(); void removeProjectInfo(ProjectExplorer::Project *project); diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index c7d375b1f2d..0d3357d9fe2 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -134,10 +134,8 @@ static QList scanDirectoryForQuickTestQmlFiles(const QStri QFutureInterface future; QmlJS::PathsAndLanguages paths; paths.maybeInsert(Utils::FileName::fromString(srcDir), QmlJS::Dialect::Qml); - const bool emitDocumentChanges = false; - const bool onlyTheLib = false; QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM, - emitDocumentChanges, onlyTheLib); + false /*emitDocumentChanges*/, false /*onlyTheLib*/, true /*forceRescan*/ ); const QmlJS::Snapshot snapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot(); QDirIterator it(srcDir, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);