Skip to content

feat: add QML language support via Qt's qmlls#1635

Open
weiconghe wants to merge 1 commit into
oraios:mainfrom
weiconghe:feat/qml-language-support
Open

feat: add QML language support via Qt's qmlls#1635
weiconghe wants to merge 1 commit into
oraios:mainfrom
weiconghe:feat/qml-language-support

Conversation

@weiconghe

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #1381

Type of change

  • New feature (non-breaking change which adds functionality)

What does this PR do?

Adds QML (Qt Modeling Language) language support to Serena using Qt's official qmlls (or qmlls6) language server.

Implementation details:

  • New QmlLanguageServer class in src/solidlsp/language_servers/qml_language_server.py that discovers the qmlls6 or qmlls binary from PATH (same pattern as Crystal/Crystalline)
  • Registered QML language in ls_config.py with .qml file extension
  • The server looks for qmlls6 first (Qt 6), then falls back to qmlls

User setup:
Users need to have Qt 6 installed with qmlls (or qmlls6) available on PATH. Qt ships this binary with the Qt 6 SDK. The language server is a standard LSP implementation, so all standard Serena features (document symbols, go-to-definition, references, etc.) should work.

How did you verify your code works?

  • Verified language registration: Language.QML resolves correctly, file extension matching works, and get_ls_class() returns QmlLanguageServer
  • Added test repository with QML source files (src/main.qml, src/shapes.qml)
  • Added basic test suite that validates server startup and document symbol retrieval
  • Tests are automatically skipped when qmlls/qmlls6 is not on PATH (guarded by language_tests_enabled)
  • All 24 existing test_file_system.py tests continue to pass

Checklist

  • I have tested my changes locally
  • I have included no unrelated changes

Screenshots / recordings

N/A

@opcode81 opcode81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

Please address the changed interface (see comment) and add an entry to the changelog.

Comment thread src/solidlsp/language_servers/qml_language_server.py Outdated
Comment thread src/solidlsp/language_servers/qml_language_server.py Outdated
@weiconghe weiconghe force-pushed the feat/qml-language-support branch from 874c02d to 2cf62ba Compare July 3, 2026 14:21
@weiconghe

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Addressed both points:

  1. Rebased onto main and adapted to the new interface:

    • Switched from ProcessLaunchInfo to the LanguageServerDependencyProviderSinglePath pattern — _find_qmlls is now _get_or_install_core_dependency inside an inner DependencyProvider class. As a side benefit, the standard ls_path / ls_args / ls_extra_args overrides now work for qmlls.
    • Renamed _get_initialize_params(repository_absolute_path)_create_base_initialize_params() (no args), returning only the capabilities; processId / rootPath / rootUri / workspaceFolders are left to the default InitializeParamsBuilder.
  2. Added a CHANGELOG entry under Language Servers.

Also dropped an unrelated already-merged commit (file_system scandir fix, PR #1634) that had accidentally landed on this branch, so the PR is now a single clean commit.

@weiconghe weiconghe force-pushed the feat/qml-language-support branch from 2cf62ba to 7955076 Compare July 3, 2026 15:12
@weiconghe

Copy link
Copy Markdown
Contributor Author

Update: I verified the server against a real qmlls locally (qmlls 0.6 standalone) and it exposed two wrong assertions in my own test suite — qmlls names QML objects by their type (ApplicationWindow, Button, Rectangle, Text), not by their id. The original assertions (mainWindow, customRect, ...) were checking id values that qmlls never surfaces as symbol names. Fixed in 7955076c; all 3 tests now pass against the real binary (server start + document symbols for both files).

Heads-up: qmlls is not installed in CI (no Qt setup in .github/workflows), so these tests currently skip in CI rather than running — they only run where qmlls/qmlls6 is on PATH. Per the add-language guide ("tests should run in CI"), it'd be worth wiring up a CI install step (qmlls ships standalone, so a small download would suffice). Happy to add that here or in a follow-up — let me know your preference.

@opcode81

opcode81 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

qmlls is not installed in CI

I am aware of this. However, CI was recently restructured by @MischaPanch and I would leave it up to him to decide whether QML should be tested and, if so, in which part of the matrix.

Add support for QML (Qt Modeling Language) files using Qt's official
qmlls (or qmlls6) language server.

- New language server class QmlLanguageServer using the
  LanguageServerDependencyProviderSinglePath pattern; the provider
  discovers qmlls6 or qmlls from PATH and inherits the standard
  ls_path / ls_args / ls_extra_args user overrides
- Register QML language with .qml extension in ls_config.py
- Add pytest marker and disabled-language check in conftest
- Create minimal QML test repository and basic test suite
- Update language support documentation and changelog

Closes oraios#1381

Co-Authored-By: Claude <noreply@anthropic.com>
@weiconghe weiconghe force-pushed the feat/qml-language-support branch from 7955076 to 9493712 Compare July 3, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFE: QML language support

2 participants