Results 1 to 4 of 4

Thread: Using VSCode with QML

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2025
    Posts
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Using VSCode with QML

    Quote Originally Posted by Zoinen View Post
    Hello. I've always used Qt Creator and was mostly happy with it, but with the recent advent of AI tools in Visual Studio Code (specifically, Cursor IDE that is a fork of VSCode), I decided to give it a try. So, here's the problem: I installed all the latest addons from Qt Company related to Qt, in my CMake project I've added -DQT_QML_GENERATE_QMLLS_INI=ON to enable .qmlls.ini files generation. File in the root folder of my project is actually being generated:
    Qt Code:
    1. [General]
    2. buildDir=D:/Code/MyProject/build
    3. no-cmake-calls=false
    4. docDir=C:/Dev/Qt6.8.1/Docs/Qt-6.8.1
    5. importPaths=
    To copy to clipboard, switch view to plain text mode 

    I've restarted IDE and QML language server, but any QML files I open don't recognize any QML modules. So, even the first line like
    Qt Code:
    1. import QtQuick
    To copy to clipboard, switch view to plain text mode 
    gives
    Qt Code:
    1. Warnings occurred while importing module "QtQuick":
    2. Failed to import QtQuick. Are your import paths set up properly? Did you set the "QT_QML_GENERATE_QMLLS_INI" CMake variable on your project to "ON"? qmllint
    To copy to clipboard, switch view to plain text mode 

    Output from QML Language Server in VSCode is not useful either. All it says:
    Qt Code:
    1. [Warn - 4:16:35 PM] Registration of file updates failed, will miss file changes from outside the editor.-32603 Request client/registerCapability failed with message: No feature implementation for workspace.didChangeWatchedFiles found. Registration failed.
    To copy to clipboard, switch view to plain text mode 


    Does anyone have any experience with using QML in VSCode? I couldn't find any decent docs since this tech is relatively new. I'm on Windows. I use Qt 6.8.2 with QML Language Server component installed
    Based on similar reports and documentation I found, the key issue seems to be that your .qmlls.ini file’s importPaths field is empty. The QML language server needs to know where to find the Qt QML modules (such as QtQuick). Typically, you need to specify the QML modules directory from your Qt installation—often something like:
    importPaths=C:/Dev/Qt6.8.1/qml
    Without this path, the language server won’t be able to resolve QML imports, which is why you’re seeing the “Failed to import QtQuick” error.

    ** Moderator's note: Spam link removed. Last warning - next time, you will be banned. **
    Last edited by d_stranz; 9th March 2025 at 16:33. Reason: removed URL

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.