aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index fc31c30e1b7..8826da30c7d 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -113,6 +113,9 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
m_defaultProjectInfo.qtQmlPath =
FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
+ m_defaultProjectInfo.qmllsPath = ModelManagerInterface::qmllsForBinPath(
+ FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::BinariesPath)),
+ QLibraryInfo::version());
m_defaultProjectInfo.qtVersionString = QLibraryInfo::version().toString();
updateImportPaths();
@@ -216,6 +219,16 @@ ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopy()
return WorkingCopy();
}
+FilePath ModelManagerInterface::qmllsForBinPath(const Utils::FilePath &binPath, const QVersionNumber &version)
+{
+ if (version < QVersionNumber(6,4,0))
+ return {};
+ QString qmllsExe = "qmlls";
+ if (HostOsInfo::isWindowsHost())
+ qmllsExe = "qmlls.exe";
+ return binPath.resolvePath(qmllsExe);
+}
+
void ModelManagerInterface::activateScan()
{
if (!m_shouldScanImports) {
@@ -415,6 +428,10 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1,
return true;
if (p1.qtQmlPath > p2.qtQmlPath)
return false;
+ if (p1.qmllsPath < p2.qmllsPath)
+ return true;
+ if (p1.qmllsPath > p2.qmllsPath)
+ return false;
const PathsAndLanguages &s1 = p1.importPaths;
const PathsAndLanguages &s2 = p2.importPaths;
if (s1.size() < s2.size())
@@ -628,6 +645,8 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(
res.qtQmlPath = pInfo.qtQmlPath;
res.qtVersionString = pInfo.qtVersionString;
}
+ if (res.qmllsPath.isEmpty())
+ res.qmllsPath = pInfo.qmllsPath;
res.applicationDirectories.append(pInfo.applicationDirectories);
for (const auto &importPath : pInfo.importPaths)
res.importPaths.maybeInsert(importPath);