qmlls: add build folder as import path

Work around QTBUG-132263 where qmlls from 6.8.2 doesn't read the
necessary .qrc files, and add the build folder (that contains all the
.qrc files) as import path for qmlls to find them.

This fixes qmlls not going to definition because of the ignored .qrc
files.

Task-number: QTBUG-132263
Change-Id: Ia0a8821a46c0cfba1767b0dea5761735ea28af06
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Sami Shalayel
2025-02-11 17:26:55 +01:00
parent 633e72f846
commit e7114956ac

View File

@@ -125,8 +125,11 @@ static CommandLine commandLineForQmlls(Project *project)
CommandLine result{executable, {}};
if (auto *configuration = project->activeBuildConfiguration())
result.addArgs({"-b", configuration->buildDirectory().path()});
const QString buildDirectory = project->activeBuildConfiguration()
? project->activeBuildConfiguration()->buildDirectory().path()
: QString();
if (!buildDirectory.isEmpty())
result.addArgs({"-b", buildDirectory});
// qmlls 6.8 and later require the import path
if (version >= QVersionNumber(6, 8, 0)) {
@@ -139,6 +142,10 @@ static CommandLine commandLineForQmlls(Project *project)
if (path.language() == QmlJS::Dialect::Qml)
result.addArgs({"-I", path.path().path()});
}
// work around QTBUG-132263 for qmlls 6.8.2
if (!buildDirectory.isEmpty())
result.addArgs({"-I", buildDirectory});
}
// qmlls 6.8.1 and later require the documentation path