From 37f69c43412a21c2419d1569ba834f273dced074 Mon Sep 17 00:00:00 2001 From: Sami Shalayel Date: Thu, 5 Dec 2024 16:52:13 +0100 Subject: qmlls: fix go to definition going to build folder Amends b1ff6073a7247c921e20cd98b2e3297e7368681b that does not find resource files of QML Modules that are not the main QML Module: use all available .qrc files in the build directory when doing operations like "go to definition". Also search for hidden folders, because .qrc files tend to be nested inside of .qt or .rcc folders. Add a test when going to the defition of a QML file defined in a different module. Pick-to: 6.8 6.9 Fixes: QTCREATORBUG-31881 Fixes: QTBUG-131920 Change-Id: I751e2cd2d1a9867459226e4f884eb1da5c1f9436 Reviewed-by: Fabian Kosmale --- src/qmlcompiler/qqmljsutils.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/qmlcompiler/qqmljsutils.cpp') diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp index 2fc0564edc..ad8a14944f 100644 --- a/src/qmlcompiler/qqmljsutils.cpp +++ b/src/qmlcompiler/qqmljsutils.cpp @@ -248,30 +248,14 @@ bool canCompareWithQUrl( return lhsType == typeResolver->urlType() && rhsType == typeResolver->urlType(); } -static QVarLengthArray resourceFoldersFromBuildFolder(const QString &buildFolder) -{ - QVarLengthArray result; - const QDir dir(buildFolder); - if (dir.exists(u".rcc"_s)) { - result.append(dir.filePath(u".rcc"_s)); - } - if (dir.exists(u".qt/rcc"_s)) { - result.append(dir.filePath(u".qt/rcc"_s)); - } - return result; -} - - QStringList QQmlJSUtils::resourceFilesFromBuildFolders(const QStringList &buildFolders) { QStringList result; for (const QString &path : buildFolders) { - for (const QString &resourceFolder : resourceFoldersFromBuildFolder(path)) { - QDirIterator it(resourceFolder, QStringList{ u"*.qrc"_s }, QDir::Files, - QDirIterator::Subdirectories); - while (it.hasNext()) { - result.append(it.next()); - } + QDirIterator it(path, QStringList{ u"*.qrc"_s }, QDir::Files | QDir::Hidden, + QDirIterator::Subdirectories); + while (it.hasNext()) { + result.append(it.next()); } } return result; -- cgit v1.2.3