aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/18.0'Eike Ziller2025-11-191-11/+0
|\ | | | | | | Change-Id: I1f547bbb03fb9ff8b41e6bd5495da0631e643265
| * AutoTest: Remove scenario testChristian Stenger2025-11-141-11/+0
| | | | | | | | | | | | | | | | This scenario does no more apply due to changed code inside handling of Qml/JS parsing. Change-Id: I4b526f6d88cdcf417799b61784a507014c56b4e9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Use QString::size() instead QString::length()hjk2025-11-131-1/+1
|/ | | | | | | Minor gain in debug builds and when stepping. Change-Id: I2540d309661e4babfd7331b068c17657ded2a098 Reviewed-by: David Schulz <david.schulz@qt.io>
* QmlLS: Avoid one use of HostOsInfo::isWindowsHost()hjk2025-10-131-4/+1
| | | | | | | | ... which would be wrong when used with a remote linux build device from a Windows host. Change-Id: I74430ae6dea05beac1eb543a58b30e0f6978dddd Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Use Utils::FilePaths instead of QList<Utils::FilePath>Alessandro Portale2025-10-021-97/+97
| | | | | | | And remove unnecessary Utils:: for FilePath[s] in affected files. Change-Id: I3eba81519c22cded8a48a197c7b1a5d7835673f4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* FutureSynchronizer: Remove clearFutures()Jarek Kobus2025-07-311-2/+2
| | | | | | | Instead, assign an empty FutureSynchronizer. Change-Id: I844546acab55b81ad2e660cd8a1efedba04bba69 Reviewed-by: hjk <hjk@qt.io>
* Utils: Further FilePathification of QrcParserhjk2025-07-141-19/+16
| | | | | Change-Id: I929d8c0b2890391fed32b6fd4aeb18d984ffe3a3 Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Partially FilePathify QrcParserhjk2025-07-141-5/+5
| | | | | Change-Id: I60f203c27c3f76cafcee10917e11ed0f860e7a77 Reviewed-by: David Schulz <david.schulz@qt.io>
* ProjectExplorer: Better separation between project managers and QmlJShjk2025-07-111-8/+0
| | | | | | | | | | | | | | | | | | | | | Previously, individual project managers depended on QmlJS, and for updates they pulled a pre-filled ProjectInfo struct from QmlJS, amended it, and pushed it back. In the new approach, indvidual project managers can add to a similar pre-filled structure from the buildsystem base implementation, after which the base implementation emits a signal containing the data, which is caught by QmlJSTool::ModelManager and there translated into QmlJS's own ProjectInfo struct. Advantage here is that the more of the necessary amending can be done centrally in the new BuildSystem::updateQmlCodeModel() and the indvidual project managers do not have to depend on QmlJS anymore. Change-Id: Ic3fbc55b9e3d980c55ac478bdf5672391214fa7b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Utils: Make FilePaths a full class instead of a QList<FilePaths> aliashjk2025-07-111-3/+3
| | | | | | | | | | | | | Creates a natural place for named constructor and conversion functions. Api: Created Utils::FilePaths as full class instead of a QList<Utils::FilePaths> alias Api: Utils::FilePath::fromStrings -> Utils::FilePaths::fromStrings Api: Utils::FilePath::fromSettingsList -> Utils::FilePaths::fromSettings Api: Utils::toFilePathList -> Utils::FilePaths::fromStrings Change-Id: I1786519206dd1fb68f410d54ce77a0846dc1f9de Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* QmlJS: Remove direct use of ProjectExplorer::Projecthjk2025-05-211-17/+16
| | | | | | | | Even if it's only used as a (mostly opaque) pointer, it's a dependency in the wrong direction. Change-Id: Ic53e3629bca73ddcd815097510ac74fd1aff53ba Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix warning for ';'Marco Bubke2025-04-151-2/+2
| | | | | | | | The macro already contain a ';'. Removing the argument or [[maybe_unused]] would maybe even a better approach. Change-Id: I31750d10a4f252c667e7c0e5e13bf1085dbe11a2 Reviewed-by: hjk <hjk@qt.io>
* Replace most expected_str by Utils::Resulthjk2025-04-111-2/+2
| | | | | | | | Keep it in Axivion dto, which is generated. Change-Id: I83a12de6234ac7b0218b369875bdc72d25dbadfb Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* qmlformatsettings: introduce qmlformat process wrapperSemih Yavuz2025-04-031-0/+7
| | | | | | | | | | | | | | We will need qmlformat process to create default options to be displayed in the preferences widget. It will also be invoked when reformat action is requested. By design, the latest qmlformat version found in the system will be used. Task-number: QTCREATORBUG-26602 Change-Id: I98c435d8941d4cdf9fcd8fbdcdcb1c05931174e7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Avoid potential detach of non-const Qt containers in range-loops 1/2Alessandro Portale2025-03-211-1/+1
| | | | | | | By making the containers const. Change-Id: I3095d7c817bd8a9cc40184aba144d617c6071f97 Reviewed-by: hjk <hjk@qt.io>
* Utils: Rename FilePath::toString() into toUrlishString()hjk2025-01-101-6/+6
| | | | | | | | | | | | | | | | toString() is almost always the wrong conversion, but unfortunately too easy to find and often even working at least for local setup. This here raises the bar as the non-availability of the "obvious" toString() hopefully helps people to think about the semantics of the needed conversion and choose the right toXXX() function. The chosen new name is intentional ugly to reduce the likelihood that this (still almost always wrong) function is used out of convenience. Change-Id: I57f1618dd95ef2629d7d978688d130275e096c0f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* QmlDesigner: Wait until ModelManagerInterface is finished when loadingThomas Hartmann2024-12-161-0/+5
| | | | | | | | | This is usually the case when opening the first file and will take about a second. This makes incomplete types a lot more improbable. Change-Id: Ie3b545283f531f362cacbeb66ec1d2d30e619566 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Preparatory changes to enable Id ctor from char(&)[]hjk2024-09-121-1/+1
| | | | | Change-Id: Ifacc56c1e5e1a13ec9e6a0e2d2f6f1087cb1fce3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ModelManagerInterface: Cancel all running threads on session switchJarek Kobus2024-02-141-0/+10
| | | | | | | | | | | | | | | | | | | | On session switch we cancel all the running tasks. We connect to the SessionManager::aboutToLoadSession() signal, as this one is emitted just before loading new session's projects. We don't connect to SessionManager::aboutToUnloadSession(), since after this signal is emitted the unloading may be canceled due to e.g. showing the dialog asking for saving changed files in the unloaded session (the user may cancel the process of unloading). In contrast to what we do on shutdown, we don't wait for futures being finished here - it's just enough we cancel all of them. Fixes: QTCREATORBUG-25583 Change-Id: I01eeca00d150f6e98a80a050c6a19efb848b9954 Reviewed-by: hjk <hjk@qt.io>
* QrcParser: Replace QSharedPointer with std::shared_ptrJarek Kobus2024-02-011-3/+3
| | | | | | | | According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews QSharedPointer impl is poor and it's going to be removed from Qt 7. Change-Id: I557804bf781b7fa58129242bd94e1566ed3ee304 Reviewed-by: hjk <hjk@qt.io>
* Qmljs: Replace QMap with QHashJarek Kobus2024-01-301-2/+3
| | | | | | | The key is a pointer type, so use QHash. Avoid double lookup. Change-Id: I6c1c8e11b89256b550cda96b9128f8329470c7cf Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* QmlJS: Fix deadlock when scanning appsMarcus Tillmanns2024-01-241-12/+17
| | | | | Change-Id: I7f8133eb634876b988675ed3b3cbebe596870a06 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
* Make some more capturelists friendlier for C++20hjk2024-01-171-1/+1
| | | | | Change-Id: Ic00f75e1f59f5eb0430d24e4448a3bb7f8bfbd8d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QMLJS: Fix deadlock on session switchMarcus Tillmanns2023-12-051-79/+95
| | | | | | | | Fixes: QTCREATORBUG-30016 Change-Id: I17d2b068e1bdb2fcad182209ca08a652b0957fa4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* QMLJS: Fix deadlockMarcus Tillmanns2023-12-051-4/+8
| | | | | | Change-Id: Ib93d2e43ed0cdb7708886224fdf7392c96f984ca Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* qmljs: Use Utils::Locked in ModelManagerMarcus Tillmanns2023-12-041-244/+291
| | | | | | | | | | Improves access to locked data by using read/write locking. Hardens thread safety by making sure that locked data is only accessed when lock is owned. Change-Id: I169fcd650cd905fc8625a341104ffbccc4c7c7c8 Reviewed-by: hjk <hjk@qt.io>
* QmlJS: Delay loading of default QML type descriptionsEike Ziller2023-09-061-3/+4
| | | | | | | | We definitely do not need to do this during startup of Qt Creator, delay to first use. Change-Id: I5942b5346aedc3d6b677918ad28a6c2924d09493 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Various Plugins: Simplify return FilePath statementsJarek Kobus2023-08-021-1/+1
| | | | | | | Change-Id: Ia9efb86f722caca1492b577d51442f1f23b804b4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CplusPlus: Use plainer callbacks to interact to the CppEditorhjk2023-07-121-4/+3
| | | | | | | | Lets us remove a few explicit CppModelManager::instance() call in user code later. Change-Id: Id8d846d06a0715b3d609cc5d52cc031e1d025fb1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix occurrences of the contains/insert anti-patternChristian Kandeler2023-06-231-8/+4
| | | | | | | | | Introduce and make use of Utils::insert() for QSet with a return value that indicates whether insertion actually happened. Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* All: Replace deprecated QLibraryInfo::locationhjk2023-06-061-2/+2
| | | | | | | | ... by QLibraryInfo::path() which exists since 6.0 Change-Id: I0e1e071e0d279ddaf1f1027a0e6ce350ab21739a Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}Jarek Kobus2023-05-031-1/+1
| | | | | | | Follows AsyncTask -> Async rename. Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225 Reviewed-by: hjk <hjk@qt.io>
* QmlJS: Use QtConcurrent invocation for async runJarek Kobus2023-03-141-47/+48
| | | | | | | | | | Add ModelManagerInterface::importScan() overload to avoid instantiating dummy QPromise arg on caller side. Change-Id: Idf836d30b2167d8840cc4e7ac6f95377c9d5622a Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* QmlJS: Tr::TrAlessandro Portale2023-02-011-5/+7
| | | | | | | | Excluding the Qml parser, which needs to remain in sync with it's copy in Qt. Change-Id: I22f475f265dd74687e3239c4d6916c777798a447 Reviewed-by: hjk <hjk@qt.io>
* QmlJS: Reduce number of for loopsMarcus Tillmanns2023-01-261-17/+18
| | | | | | | | | | Removes some unnecessary contains() by using the QSet directly. Fetch all required paths at once instead of calling generatedQrc(...) multiple times. Change-Id: I0a6f65d11d92a4ec4f6655a87e30df6a5c4d6545 Reviewed-by: hjk <hjk@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/qds/dev'Tim Jenssen2022-12-221-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp src/plugins/updateinfo/updateinfoplugin.cpp src/tools/qml2puppet/CMakeLists.txt src/tools/qml2puppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp Change-Id: I6b65ce2d603453fcebc2291574d55db80853f247
| * qmljs: improve readabilityTim Jenssen2022-12-141-1/+1
| | | | | | | | | | Change-Id: I110c2b08bcdfc29b310b84378cd3b119ee7f5f91 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Merge remote-tracking branch 'origin/qds/dev'Tim Jenssen2022-12-141-2/+2
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturesmodel.cpp Change-Id: Ieda6242b845387100022b08251283891fb0fbda7
| * qmljs: fix warningTim Jenssen2022-11-251-1/+1
| | | | | | | | | | | | Change-Id: I69714d6626d9135c5489258346f79b1c4bfbcd19 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
| * QmlJS: std::set instead of QListThomas Hartmann2022-11-231-2/+2
| | | | | | | | | | | | | | | | | | This reduces the CPU time of Export::visibleInVContext() from 50% to 15% on Windows, when switching files. Change-Id: Iff82924c47d1b696c9d3d7ca40f49d9d02bcb3e6 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
| * Merge remote-tracking branch 'origin/9.0' into qds/devTim Jenssen2022-11-091-12/+12
| |\ | | | | | | | | | Change-Id: I02fd6f492c27d85b88af7ec8bc18ff62f2c6ed14
* | | Utils: Add std::expected implementationMarcus Tillmanns2022-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a std::expected implementation that is compatible with >= C++11. FilePath::fileContents and FilePath::writeFileContents as well as FilePath::copyFile are changed to return std::expected. A couple of macros have been added to aid in using the expected types. An auto test was added showing how to use the library. Change-Id: Ibe3aecfc1029a0cf13b45bf5184ff03a04a2393b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | | CPlusPlus: Proliferate FilePath usehjk2022-11-221-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The starts with CppDocument::filePath(), plus a bit of the fallout This is one patch of potentially many. It is hard to draw the line where to stop this kind of chunk, this here converts a few additional functions for which including it in the patch looked like less churn than without. Converting is mostly fromString/toString, with a few exceptions for "already seem" like caches, that use cheaper "path()" to avoid likely performance regressions (on Windows FilePath comparison is currently case-insenstive, and more expensive). There should be no difference for local operation with this patch. Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | | Merge remote-tracking branch 'origin/9.0'Eike Ziller2022-11-101-12/+12
|\ \ \ | |/ / |/| / | |/ Change-Id: Ie069f3b2a1200b3e665341b1d56ce836024b0d29
| * QmlJS: Fix Follow under cursorMarcus Tillmanns2022-11-081-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to jump to a symbol in a qml file the Qml Model may find the location in a generated .qml file in the build folder. QtCreator searches in all generated .qrc files to try and find the source file so it can jump to it instead. Previously not all auto-generated ".rcc" folders would be found as only the folders of targets (executables) were searched. Plugins or Static Libraries were not searched. With this fix, all projects nodes are searched for the ".rcc" folder and therefore also finds them for Dynamic / Static libraries and plugins. Fixes: QTCREATORBUG-27173 Change-Id: Ic51ac8fbc82c15785cbefd76787942a512ecf3db Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* | Automatic qmlls support (experimental)Fawzi Mohamed2022-10-121-0/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks for qmlls (the qml language server of Qt) and if available and set in the preferences uses it instead of the embedded code model for the supported features. Its usage is driven by two flags that can be set in the QtQuick > QML/JS Editing preferences: "use qmlls" activates the use of qmlls if available; "use latest qmlls" always uses the qmlls of the latest Qt, instead of the one of the target (with the one used to compile QtCreator as fallback). To support disabling/enabling of qmlls as soon as one changes the preferences the singleton QmllsSettingsManager can emit a signal on changes. It also keeps track of the latest qmlls binary known. QmlJS::ModelmanagerInterface::ProjectInfo is also extended to keep track of the qmlls binary. QmlJSEditorDocument uses the ProjectInfo and QmllsSettingsManager to decide if a LanguageClient::Client should be started for that document. The client uses the QmllsClient subclass to keep track of the path of the qmlls clients and use the same qmlls process or all files that use the same binary. Currently qmlls <6.4.0 are not considered because they might have too many issues. The enabling/disabling of warnings and highlight is a bit cumbersome because they are handled together in the semantic highlighter, but must be handled separately depending on the qmlls capabilities. The disabling is done at the latest moment stopping the visualization of the embedded model warnings/highlights/suggestions. The computation of the semantic info is not suppressed to support the other features (find usages, semantic highlighting if active,...). When qmlls supports more features a complete removal of the semantic info construction could be evaluated. Change-Id: I3487e1680841025cabba6b339fbfe820ef83f858 Reviewed-by: David Schulz <david.schulz@qt.io>
* Use more Utils::isMainThread()Jarek Kobus2022-10-111-2/+1
| | | | | Change-Id: Ia3c6f6dca53c5d7487b0813de16f06c52af47aa5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-25/+25
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
* FilePath: Return optional bytearray for file contentsEike Ziller2022-09-121-4/+6
| | | | | | | For differentiating between "error" and "empty file". Change-Id: I2c019ceac625e7be3180afa4d47ae3a24df91c1d Reviewed-by: hjk <hjk@qt.io>