QML Language Server
QML Language Server is a tool shipped with Qt that helps you write code in your favorite (LSP-supporting) editor. See Language Server Protocol for more information.
Currently, it enables your editor to:
- Autocomplete your code
- Display qmllint warnings
- Navigate to definitions in QML files
- Format QML files
Note: qmlls is currently in development, see Known Limitations for more details.
QML Language Server can automatically lint opened QML files and display warnings or errors straight in the editor. See qmllint for more information about the linting process.
QML Language Server can format entire files from inside the editor. See qmlformat for more information about the formatting process.
Note: You can find the QML Language Server binary under
<Qt installation folder>/bin/qmlls in installations of Qt made with the official Maintenance Tool.
QML Language Server also needs to know the location of your build folder. You can pass it the following ways:
--build-dircommand line option. In this case your editor should invoke
<path/to/qmlls> --build-dir <path/to/build-directory>
.qmlls.inisettings file, see Configuration File.
Note: When the build directory is specified in multiple ways, the command line option takes preference over the environment variable that takes precedence over the setting file.
QML Language Server can be configured via a configuration file
.qmlls.ini. This file should be in the root source directory of the project. It should be a text file in the ini-format.
The configuration file should look like this:
// .qmlls.ini [General] buildDir=<path/to/build-directory>
Currently, the configuration file can only be used to set the build directory of the current project.
Note: QML Language Server can create default configuration files using the
--write-defaults option. This will overwrite an already existing .qmlls.ini file in the current directory.
QML Language Server might emit false positive warnings on projects that were not built, as it needs the build information to find QML modules defined in the same project, for example.
Despite covering many common QML features, the QML Language Server is still in development with some features yet to be supported:
- Formatting only parts of a document.
- Formatting using a configurable set of rules.
- Navigating to definitions of objects defined in C++.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.