Commit 8f27c438 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Don't use full mime type detection to decide between qml/js.

Determining the mime type is too expensive - and for deciding between
qml and js files comparing suffixes is sufficient.

Reviewed-by: Friedemann Kleint
parent 2cbe7a36
......@@ -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 =;
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;
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