Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to configure QmlLs property
Forum Updated to NodeBB v4.3 + New Features

How to configure QmlLs property

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 47 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alejandro Vaquero
    wrote last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved