lassik / emacs-format-all-the-code

Auto-format source code in many languages with one command
https://melpa.org/#/format-all
MIT License
611 stars 106 forks source link

Issue with replacing Brittany with Ormolu #256

Closed sdban closed 4 months ago

sdban commented 4 months ago

I installed ormolu and tried using it in format-all.

# Snippet from emacs init file. 

 (use-package
  format-all
  :ensure t
  :diminish format-all-mode -- this causes an error in the init file.
  :config
  (setq-default format-all-formatters
                '(("Haskell" (ormolu --mode inplace))))
  :init
  (progn
    (add-hook 'prog-mode-hook 'format-all-mode)  ;; enables format-all mode in the prog-mode buffer
    (add-hook 'format-all-mode-hook 'format-all-ensure-formatter))
  )

When I run it on a haskell file I get an error about Brittany.

Formatter not found: "You need the brittany command. You may be able to install it via: stack install brittany"

On the command line

ormolu HaskellFile.hs works.

Any suggestions! Thank you for this package. It is very helpful.

lassik commented 4 months ago

(ormolu --mode inplace) should be (ormolu "--mode" "inplace").

I'm not familiar with use-package myself, so I'm not sure about the rest.

sdban commented 4 months ago

Thank you so much! Just

(ormolu)
works great.

The additional >"--mode inplace" was causing some problems.

Thank you for the help!