diff --git a/src/core/toolsupport.cpp b/src/core/toolsupport.cpp index ad193355..afce008b 100644 --- a/src/core/toolsupport.cpp +++ b/src/core/toolsupport.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "logcat.hpp" @@ -78,16 +78,10 @@ bool QmlToolingSupport::lockTooling() { QString QmlToolingSupport::getQmllsConfig() { static auto config = []() { - QList importPaths; - - auto addPaths = [&](const QList& paths) { - for (const auto& path: paths) { - if (!importPaths.contains(path)) importPaths.append(path); - } - }; - - addPaths(qEnvironmentVariable("QML_IMPORT_PATH").split(u':', Qt::SkipEmptyParts)); - addPaths(qEnvironmentVariable("QML2_IMPORT_PATH").split(u':', Qt::SkipEmptyParts)); + // We can't replicate the algorithm used to create the import path list as it can have distro + // specific patches, e.g. nixos. + auto importPaths = QQmlEngine().importPathList(); + importPaths.removeIf([](const QString& path) { return path.startsWith("qrc:"); }); auto vfsPath = QsPaths::instance()->shellVfsDir()->path(); auto importPathsStr = importPaths.join(u':');