Skip to content

Add support for the qml language server #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| Python | ruff | Yes | Yes |
| Python | ruff-lsp | Yes | Yes |
| Prisma | prisma-language-server | Yes | Yes |
| Qml | qmlls | Yes | Yes |
| R | languageserver | Yes | No |
| Racket | racket-lsp | Yes | No |
| Reason | reason-language-server | Yes | Yes |
Expand Down Expand Up @@ -400,6 +401,20 @@ let g:lsp_settings = {
\ }
\}
```
### [qmlls](https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html)

To use the language server you need a .qmlls.ini, which can be generated
automatically. Additionally, you have to configure your the qml include
directories from the qt install root.
```vim
let g:lsp_settings = {
\ 'qmlls': {
\ 'args': ['-I', '[QTROOT]/qml'],
\ },
\}

By default, the qmlls server will search the QML_IMPORT PATH (-E option).
```

### [rubocop lsp mode (Ruby)](https://docs.rubocop.org/rubocop/usage/lsp.html)

Expand Down
7 changes: 7 additions & 0 deletions installer/install-qmlls.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off

setlocal
set version="0.2"
curl -L -o "qmlls-windows.zip" "https://github.com/TheQtCompanyRnD/qmlls-workflow/releases/download/%version%/qmlls-windows-%version%.zip"
call "%~dp0\run_unzip.cmd" qmlls-windows.zip qmlls.exe
del qmlls-windows.zip
27 changes: 27 additions & 0 deletions installer/install-qmlls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
url="${url_ubuntu}"
platform="ubuntu"
version="0.2"

case $os in
linux)
platform="ubuntu"
;;
darwin)
platform="macos"
;;
*)
echo "unknow platform: $os"
exit 1
;;
esac

curl -L -o "qmlls-${platform}.zip" "https://github.com/TheQtCompanyRnD/qmlls-workflow/releases/download/${version}/qmlls-${platform}-${version}.zip"

tar -xf "qmlls-${platform}.zip" qmlls
rm "qmlls-${platform}.zip"
chmod +x qmlls

11 changes: 11 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,17 @@
]
}
],
"qml": [
{
"command": "qmlls",
"url" : "https://github.com/qt/qtdeclarative",
"description": "An implementation of the Language Server Protocol for qml/qmljs",
"requires": [],
"root_uri_patterns": [
".qmlls.ini"
]
}
],
"r": [
{
"command": "r-languageserver",
Expand Down
11 changes: 11 additions & 0 deletions settings/qmlls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
augroup vim_lsp_settings_qmlls
au!
LspRegisterServer {
\ 'name': 'qmlls',
\ 'cmd': {server_info->lsp_settings#get('qmlls', 'cmd', [lsp_settings#exec_path('qmlls')])+lsp_settings#get('qmlls', 'args', ['-E'])},
\ 'root_uri':{server_info->lsp_settings#get('qmlls', 'root_uri', lsp_settings#root_uri('qmlls'))},
\ 'allowlist': lsp_settings#get('qmlls', 'allowlist', ['qml', 'qmljs']),
\ 'blocklist': lsp_settings#get('qmlls', 'blocklist', []),
\ 'config': lsp_settings#get('qmlls', 'config', lsp_settings#server_config('pyls-all')),
\ }
augroup END
Loading