From 5cbc7a0258eef20914cf135b5aed370f490bc682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellis=20Keny=C5=91?= Date: Tue, 16 Aug 2022 20:57:40 +0100 Subject: [PATCH] feat(format): add :lang nim formatter --- modules/lang/nim/config.el | 2 ++ modules/lang/nim/doctor.el | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/lang/nim/config.el b/modules/lang/nim/config.el index 377154627..d15c271c5 100644 --- a/modules/lang/nim/config.el +++ b/modules/lang/nim/config.el @@ -12,6 +12,8 @@ nimsuggest isn't installed." (when (and nimsuggest-path (file-executable-p nimsuggest-path)) (nimsuggest-mode)))) + (set-formatter! 'nmfmt '("nimfmt" filepath) :modes '(nim-mode)) + (when IS-WINDOWS ;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode) (defadvice! +nim--suggest-get-temp-file-name-a (path) diff --git a/modules/lang/nim/doctor.el b/modules/lang/nim/doctor.el index 788238c98..32980d7ed 100644 --- a/modules/lang/nim/doctor.el +++ b/modules/lang/nim/doctor.el @@ -1,4 +1,4 @@ -;; -*- lexical-binding: t; no-byte-compile: t; -*- + ;;; lang/nim/doctor.el (unless (executable-find "nimsuggest") @@ -7,3 +7,6 @@ (unless (executable-find "nim") (warn! "Could not find nim executable; build commands will be disabled.")) +(when (modulep! :editor format) + (unless (executable-find "nimfmt") + (warn! "Could not find nimfmt. Formatting will be disabled.")))