From 3c96f33cb8d43cabea5b01dd8e5c451826da2b4c Mon Sep 17 00:00:00 2001 From: Ellis Kenyo Date: Mon, 24 Jul 2023 19:43:58 +0100 Subject: [PATCH] feat(format): add :lang scala formatter --- modules/lang/scala/config.el | 2 ++ modules/lang/scala/doctor.el | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/modules/lang/scala/config.el b/modules/lang/scala/config.el index c78a23b3f..d42e879db 100644 --- a/modules/lang/scala/config.el +++ b/modules/lang/scala/config.el @@ -22,6 +22,8 @@ (when (modulep! +tree-sitter) (add-hook 'scala-mode-local-vars-hook #'tree-sitter! 'append)) + (set-formatter! 'scalafmt '("scalafmt" "--stdin") :modes '(scala-mode)) + (set-ligatures! 'scala-mode ;; Functional :def "def" diff --git a/modules/lang/scala/doctor.el b/modules/lang/scala/doctor.el index 917a129bd..fc72e2f18 100644 --- a/modules/lang/scala/doctor.el +++ b/modules/lang/scala/doctor.el @@ -11,3 +11,7 @@ (if (and (modulep! +lsp) (not (executable-find "metals"))) (warn! "metals isn't installed")) + +(when (modulep! :editor format) + (unless (executable-find "scalafmt") + (warn! "Couldn't find scalafmt. Formatting will be disabled.")))