From 9343b86f7c6c51866bb9e682dbc9c3233748aecc Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 21 Sep 2024 19:54:44 -0700 Subject: [PATCH] [#312] Fix Ormolu installation and invocation (#321) Closes #312. The installation script was failing due to some Cabal bullshit that I don't even want to know the reason for, probably triggered by new package versions coming available, so I switched to upstream binaries. Applied the suggested fix from #312 for a new command-line option which has become required. Also set Ormolu as the default Haskell formatter instead of Brittany because that is what the Brittany dev recommends (see again #312). --- CHANGELOG.md | 4 ++++ apheleia-formatters.el | 4 ++-- test/formatters/installers/ormolu.bash | 7 +++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42a478ab..bce8fbd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,12 +25,16 @@ The format is based on [Keep a Changelog]. * `apheleia-npx` was sometimes not able to find formatters in a Yarn PnP project if there was also a `node_modules` folder at the root of the project ([#301]). +* Ormolu is now passed the `--stdin-input-file` argument, which has + become required ([#312]). ## Internal * Improvements to formatter test framework, it is now possible to write tests that have additional data files ([#301]). [#301]: https://github.com/radian-software/apheleia/pull/301 +[#306]: https://github.com/radian-software/apheleia/pull/306 +[#312]: https://github.com/radian-software/apheleia/issues/312 [#313]: https://github.com/radian-software/apheleia/pull/313 [#316]: https://github.com/radian-software/apheleia/pull/316 [#317]: https://github.com/radian-software/apheleia/issues/317 diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 55783984..2446d129 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -96,7 +96,7 @@ (ocamlformat . ("ocamlformat" "-" "--name" filepath "--enable-outside-detected-project")) (ocp-indent . ("ocp-indent")) - (ormolu . ("ormolu")) + (ormolu . ("ormolu" "--stdin-input-file" filepath)) (perltidy . ("perltidy" "--quiet" "--standard-error-output" (apheleia-formatters-indent "-t" "-i") (apheleia-formatters-fill-column "-l"))) @@ -320,7 +320,7 @@ rather than using this system." (go-mode . gofmt) (go-ts-mode . gofmt) (graphql-mode . prettier-graphql) - (haskell-mode . brittany) + (haskell-mode . ormolu) (hcl-mode . hclfmt) (html-mode . prettier-html) (html-ts-mode . prettier-html) diff --git a/test/formatters/installers/ormolu.bash b/test/formatters/installers/ormolu.bash index db6c4d45..3137856d 100644 --- a/test/formatters/installers/ormolu.bash +++ b/test/formatters/installers/ormolu.bash @@ -1,4 +1,3 @@ -apt-get install -y ghc cabal-install -cabal v2-update -cabal v2-install ormolu --reorder-goals -cp "${HOME}/.cabal/bin/ormolu" /usr/local/bin +wget -nv https://github.com/tweag/ormolu/releases/download/0.7.7.0/ormolu-x86_64-linux.zip -O ormolu.zip +unzip ormolu.zip +cp ormolu /usr/local/bin/