tweak(erlang): format w/ erlfmt instead of efmt

This commit is contained in:
Eleanor Bartle 2024-09-08 05:11:43 +10:00 committed by GitHub
parent ed05e4c088
commit ac1122ae67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -40,7 +40,7 @@ This module requires Erlang be installed (which includes ~erlang-mode~). Check
your distribution's package manager or a version management tool such as [[https://github.com/kerl/kerl][kerl]].
- [[https://github.com/erlang/sourcer][sourcer]] when [[doom-module::tools lsp]] & [[doom-module:+lsp]]
- [[https://github.com/sile/efmt][efmt]] when [[doom-module::editor format]]
- [[https://github.com/erlang/rebar3][rebar3]] with [[https://github.com/WhatsApp/erlfmt][erlfmt]] when [[doom-module::editor format]]
* TODO Usage
#+begin_quote

View file

@ -5,7 +5,7 @@
:mode ("/rebar\\.config\\(?:\\.script\\)?\\'" . erlang-mode)
:mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode)
:config
(set-formatter! 'efmt '("efmt" "-") :modes '(erlang-mode))
(set-formatter! 'erlfmt '("rebar3" "fmt" "-") :modes '(erlang-mode))
(when (modulep! +lsp)
(add-hook 'erlang-mode-local-vars-hook #'lsp! 'append))

View file

@ -6,5 +6,5 @@
"This module requires (:tools lsp)")
(when (modulep! :editor format)
(unless (executable-find "efmt")
(warn! "Couldn't find efmt. Formatting will be disabled.")))
(unless (and (executable-find "rebar3") (zerop (car (doom-call-process "rebar3" "fmt" "-v"))))
(warn! "Couldn't find erlfmt. Formatting will be disabled.")))