feat(dart): add treesit support

This does not port over the keybinds to dart-ts-mode. Those will be done
separately.
This commit is contained in:
Henrik Lissner
2025-06-28 21:13:11 +02:00
parent 7c6e1950e8
commit a287a96aca
4 changed files with 35 additions and 7 deletions

View File

@@ -1,11 +1,7 @@
;;; lang/dart/config.el -*- lexical-binding: t; -*-
(use-package! dart-mode
:hook (dart-mode . rainbow-delimiters-mode)
:config
(when (modulep! +lsp)
(add-hook 'dart-mode-local-vars-hook #'lsp! 'append))
(set-ligatures! '(dart-mode)
(defun +dart-common-config (mode)
(set-ligatures! mode
;; Functional
:def "Function"
:lambda "() =>"
@@ -23,7 +19,25 @@
:for "for"
:return "return"
;; Other
:yield "yield"))
:yield "yield")
(when (modulep! +lsp)
(add-hook (intern (format "%s-local-vars-hook" mode)) #'lsp! 'append)))
(use-package! dart-mode
:hook (dart-mode . rainbow-delimiters-mode)
:config
(+dart-common-config 'dart-mode))
(use-package! dart-ts-mode
:when (modulep! +tree-sitter)
:defer t
:init
(set-tree-sitter! 'dart-mode 'dart-ts-mode
'((dart :url "https://github.com/ast-grep/tree-sitter-dart")))
:config
(+dart-common-config 'dart-ts-mode))
(use-package! flutter