diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 637bc564007c0774f7481da5ab102c023699ae73..8408c853f7e48493109d41ddca2befda9c1bb72d 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -367,6 +367,15 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap } } +static bool suffixMatches(const QString &fileName, const Core::MimeType &mimeType) +{ + foreach (const QString &suffix, mimeType.suffixes()) { + if (fileName.endsWith(suffix, Qt::CaseInsensitive)) + return true; + } + return false; +} + void ModelManager::parse(QFutureInterface<void> &future, WorkingCopy workingCopy, QStringList files, @@ -395,19 +404,13 @@ void ModelManager::parse(QFutureInterface<void> &future, const QString fileName = files.at(i); - const QFileInfo fileInfo(fileName); - Core::MimeType fileMimeTy; - bool isQmlFile = true; - if (db) { - fileMimeTy = db->findByFile(fileInfo); - - if (matchesMimeType(fileMimeTy, jsSourceTy)) + if (suffixMatches(fileName, jsSourceTy)) { isQmlFile = false; - - else if (! matchesMimeType(fileMimeTy, qmlSourceTy)) + } else if (! suffixMatches(fileName, qmlSourceTy)) { continue; // skip it. it's not a QML or a JS file. + } } else { if (fileName.contains(QLatin1String(".js"), Qt::CaseInsensitive)) isQmlFile = false;