Skip to content

Commit

Permalink
feat(emacs): Add dart support
Browse files Browse the repository at this point in the history
  • Loading branch information
TLATER committed Aug 31, 2024
1 parent ebc97c3 commit 48dbc93
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions home-config/dotfiles/emacs.d/config/programming-languages.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
;; ----------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand All @@ -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))
Expand Down

0 comments on commit 48dbc93

Please sign in to comment.