From c9e790843abc554b2ad20b31068187f9926e795f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Mon, 5 Aug 2024 23:43:43 +0200 Subject: [PATCH] feat(emacs): Add dart support --- .../emacs.d/config/programming-languages.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/home-config/dotfiles/emacs.d/config/programming-languages.el b/home-config/dotfiles/emacs.d/config/programming-languages.el index 6b328f17..739feda1 100644 --- a/home-config/dotfiles/emacs.d/config/programming-languages.el +++ b/home-config/dotfiles/emacs.d/config/programming-languages.el @@ -245,6 +245,14 @@ string-end) . systemd-mode)) +;; ---------------------------------------------------------------------------------- +;;; Dart +;; ---------------------------------------------------------------------------------- + +(leaf dart-mode + :mode `(,(rx ".dart" string-end)) + :hook (dart-mode-hook . (lambda () (set (make-local-variable 'eglot-x-client-commands) '())))) + ;; ---------------------------------------------------------------------------------- ;;; TypeScript (and other web-related DSLs) ;; ---------------------------------------------------------------------------------- @@ -307,7 +315,8 @@ (leaf eglot :commands (eglot eglot-format eglot-managed-p) :hook (((kotlin-mode-hook web-mode-hook rust-mode-hook python-mode-hook - sh-mode-hook bash-ts-mode-hook c-mode-hook c++-mode-hook nix-mode-hook json-mode-hook) . + sh-mode-hook bash-ts-mode-hook c-mode-hook c++-mode-hook nix-mode-hook json-mode-hook + dart-mode-hook) . eglot-ensure) (eglot-managed-mode-hook . set-eldoc-compose)) :bind (:eglot-mode-map @@ -400,7 +409,10 @@ (reformatter-define latexindent :program "latexindent" :group 'latex-mode - :lighter " LF"))) + :lighter " LF") + (reformatter-define dart-format + :program "dart" + :args '("format")))) (defun autoformat () "Autoformat the current buffer." @@ -410,6 +422,8 @@ (clang-format-buffer)) ('latex-mode (latexindent-buffer)) + ('dart-mode + (dart-format-buffer)) ((or 'mhtml-mode 'web-mode 'scss-mode 'json-mode) (biome-format-buffer)) ('haskell-mode (haskell-mode-stylish-buffer))