fix(qt): eglot support

Also refactor module out of autoload.el into config.el (now that it's
non-trivial).

Ref: doomemacs/community#24
This commit is contained in:
Henrik Lissner
2025-08-31 14:47:03 +02:00
parent 94a1fe64a8
commit 571766e6ba
2 changed files with 27 additions and 14 deletions

View File

@@ -1,14 +0,0 @@
;;; lang/qt/autoload.el -*- lexical-binding: t; -*-
;;;###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))

27
modules/lang/qt/config.el Normal file
View File

@@ -0,0 +1,27 @@
;;; lang/qt/config.el -*- lexical-binding: t; -*-
(defun +qt-common-config (mode)
(when (modulep! +lsp)
(set-eglot-client! mode '("qmlls"))
(add-hook (intern (format "%s-local-vars-hook" mode)) #'lsp! 'append)))
(use-package! qml-mode
:defer t
:config
(+qt-common-config 'qml-mode))
(use-package! qml-ts-mode
:when (modulep! +tree-sitter)
:when (fboundp 'treesit-available-p)
:defer t
:init
(set-tree-sitter! 'qml-mode 'qml-ts-mode
'((qmljs :url "https://github.com/yuja/tree-sitter-qmljs")))
:config
(+qt-common-config 'qml-ts-mode))
(use-package! qt-pro-mode
:mode "\\.pr[io]\\'")