I think I got a better understanding now. When I open a .qml
file in VSCode the Qt Extension Pack
generates a new CMake tool kit entry here: ~/.local/share/CMakeTools/cmake-tools-kits.json
(which did not work the first time but eventually it worked and it creates four identical entries but I don’t care as it is working now).
The VSCode CMake extension then picks up the list of kits and lets me select one when I execute the VSCode command CMake: Select a Kit
. As soon as I select e.g. Qt-6.8.3-linux-g++
intellisense starts working properly. The entry Qt-6.8.3-linux-g++
links to the following configuration in ~/.local/share/CMakeTools/cmake-tools-kits.json
:
{
"name": "Qt-6.8.3-linux-g++",
"isTrusted": true,
"cmakeSettings": {
"QT_QML_GENERATE_QMLLS_INI": "ON"
},
"preferredGenerator": {
"name": "Ninja"
},
"toolchainFile": "/usr/lib/cmake/Qt6/qt.toolchain.cmake",
"environmentVariables": {
"VSCODE_QT_QTPATHS_EXE": "/usr/lib/qt6/bin/qmake6",
"PATH": "/usr:/usr/lib/qt6:/usr/share/qt6:/usr/share/doc/qt6:/usr/include/qt6:/usr/lib:/usr/lib/qt6/bin:/usr/tests:/usr/lib/qt6/plugins:/usr/lib/qt6/qml:/usr/share/qt6/translations:/usr/share/doc/qt6/examples:${env:PATH}"
}
}
One can see that the referenced Qt installation is located at /usr/lib/qt6
. Below that folder there are also KDE related QML folders, e.g. qml/org/kde/plasma/
.
The content of qml/org/kde/plasma/
is:
/u/l/q/q/o/k/plasma> ls -lah /usr/lib/qt6/qml/org/kde/plasma/
insgesamt 0
drwxr-xr-x 1 root root 266 23. Jan 10:40 ./
drwxr-xr-x 1 root root 1018 23. Jan 10:40 ../
drwxr-xr-x 1 root root 208 17. Mär 19:47 activityswitcher/
drwxr-xr-x 1 root root 1,5K 17. Mär 19:46 components/
drwxr-xr-x 1 root root 232 17. Mär 19:46 core/
drwxr-xr-x 1 root root 180 17. Mär 19:47 emoji/
drwxr-xr-x 1 root root 766 17. Mär 19:46 extras/
drwxr-xr-x 1 root root 64 1. Apr 22:13 lookandfeel/
drwxr-xr-x 1 root root 164 17. Mär 19:47 networkmanagement/
drwxr-xr-x 1 root root 60 17. Mär 19:46 PimCalendars/
drwxr-xr-x 1 root root 164 17. Mär 19:46 plasma5support/
drwxr-xr-x 1 root root 128 17. Mär 19:47 printmanager/
drwxr-xr-x 1 root root 756 30. Mär 19:28 private/
drwxr-xr-x 1 root root 18 16. Sep 2024 wallpapers/
drwxr-xr-x 1 root root 124 16. Sep 2024 workspace/
Which is exactly the list of importable modules. There is no plasmoid
folder so it makes sense that I cannot import it.
This means that, I think, import org.kde.plasma.plasmoid
is somehow special.
The folders below /usr/lib/qt6/qml/org/kde
are populated by different Arch packages like extra/plasma-desktop
, extra/kdepim-addons
and extra/libplasma
.
So to summarize:
- I don’t necessarily need to build plasma to import plasma modules
- I can import everything located under
/usr/lib/qt6/qml
(more specifically /usr/lib/qt6/qml/org/kde/
), without extra configuration
- There is no
plasmoid
folder under /usr/lib/qt6/qml/org/kde/plasma/
and so I cannot import it. Something else happens, maybe the plasmoid
package is injected at runtime like it is the case with the i18n
function:
Quote from your second link:
Our translation functions, i18n and friends, are considered unqualified lookups by qmllint/qmlls. This is because they are magically injected into the engine at runtime.
I guess this is the best I can achieve for now, from your linked posts it sounds like the language server is still under heavy development and I will then just wait for improvements. The language server is already a big help, even with the remaining issues present.
Thanks also for your help so far!