How to configure QmlLs property
-
Good morning!!
I’m trying to configure qmlls in Neovim. I have the qmlls LSP installed correctly, and it starts successfully when opening a .qml file.
The problem I’m facing is that when I set the QT_QML_GENERATE_QMLLS_INI variable to generate the .qmlls.init files, they are generated correctly — pointing to the local Qt installation, the documentation, and the available QMLs from QtQuick.
However, when I try to use hover (K) to see the signature of each component, the documentation does not appear. Additionally, components created in C++ and used in QML are not resolved by the LSP.
Here is an example of a CMakeLists.txt that uses C++ components:
qt_add_qml_module(ui-qt-excursion URI excursion VERSION 1.0 QML_FILES Excursion.qml SOURCES ExcursionExecutable.cpp ExcursionExecutable.hpp OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/excursion )
The .qml file is resolved correctly, but ExcursionExecutable is not.
In the build directory, a .qmltypes file is generated correctly with all the information for the C++ component:import QtQuick.tooling 1.2 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // // This file was auto-generated by qmltyperegistrar. Module { Component { file: "ExcursionExecutable.hpp" name: "ui::qt::excursion::ExcursionExecutable" accessSemantics: "reference" defaultProperty: "data" parentProperty: "parent" prototype: "QQuickItem" exports: ["excursion/ExcursionExecutable 1.0"] exportMetaObjectRevisions: [256] Property { name: "title" type: "QString" read: "tittle" write: "setTittle" notify: "tittleChange" index: 0 } Signal { name: "tittleChange" } Method { name: "findExcursions"; type: "QString"; isList: true } } }
According to the official documentation, this setup should work.
Here’s an example of one of the generated .qmlls.init files:[General] buildDir="/home/alejandro/workspace/excursions/build" no-cmake-calls=false docDir=/opt/Qt/Docs/Qt-6.9.1 importPaths="/opt/Qt/6.9.1/gcc_64/qml"
Does anyone know why this happens?
In QtCreator it works perfectly, but I can’t figure out how it’s configured internally in QtCreator to replicate the setup.