feat(qt): add treesit (and lsp) support

This commit is contained in:
Henrik Lissner
2025-08-28 14:00:48 +02:00
parent cfadd8f6a4
commit 93c085fa13
4 changed files with 32 additions and 1 deletions

View File

@@ -13,10 +13,16 @@ This module provides language functionality for [[https://qt.io][Qt]] specific f
*This module needs a maintainer.* [[doom-contrib-maintainer:][Become a maintainer?]]
** Module flags
/This module has no flags./
- +lsp ::
Enable LSP support for ~qml-mode~/~qml-ts-mode~. Requires [[doom-module::tools lsp]]
and a langserver (supports [[https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html][qmlls]]).
- +tree-sitter ::
Leverages tree-sitter for better syntax highlighting and structural text
editing. Requires [[doom-module::tools tree-sitter]].
** Packages
- [[doom-package:qml-mode]]
- [[doom-package:qml-ts-mode]] if [[doom-module:+tree-sitter]]
- [[doom-package:qt-pro-mode]]
** Hacks

View File

@@ -2,3 +2,13 @@
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.pr[io]\\'" . qt-pro-mode))
;;;###autoload
(when (modulep! +tree-sitter)
(set-tree-sitter! 'qml-mode 'qml-ts-mode
'((qmljs :url "https://github.com/yuja/tree-sitter-qmljs"))))
;;;###autoload
(when (modulep! +lsp)
(add-hook 'qml-mode-local-vars-hook #'lsp! 'append)
(add-hook 'qml-ts-mode-local-vars-hook #'lsp! 'append))

View File

@@ -0,0 +1,9 @@
;;; lang/qt/doctor.el -*- lexical-binding: t; -*-
(assert! (or (not (modulep! +lsp))
(modulep! :tools lsp))
"This module requires (:tools lsp)")
(assert! (or (not (modulep! +tree-sitter))
(modulep! :tools tree-sitter))
"This module requires (:tools tree-sitter)")

View File

@@ -3,3 +3,9 @@
(package! qml-mode :pin "6c5f33ba88ae010bf201a80ee8095e20a724558c")
(package! qt-pro-mode :pin "7a2da323de834294b413cbbb3c92f42f54913643")
(when (modulep! +tree-sitter)
(package! qml-ts-mode
:recipe (:host github
:repo "xhcoding/qml-ts-mode")
:pin "b80c6663521b4d0083e416e6712ebc02d37b7aec"))