Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let HIndent format multiple files in parallel #914

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Support for GHC 9.8 ([#775]).
- Support for `ImportPostQualified` ([#875]).
- HIndent now formats multiple files in parallel ([#914]).

### Changed

Expand Down Expand Up @@ -377,6 +378,7 @@ This version is accidentally pushlished, and is the same as 5.3.3.
[@uhbif19]: https://github.com/uhbif19
[@toku-sa-n]: https://github.com/toku-sa-n

[#914]: https://github.com/mihaimaruseac/hindent/pull/914
[#875]: https://github.com/mihaimaruseac/hindent/pull/875
[#873]: https://github.com/mihaimaruseac/hindent/pull/873
[#868]: https://github.com/mihaimaruseac/hindent/pull/868
Expand Down
15 changes: 10 additions & 5 deletions hindent.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ library
Paths_hindent
hs-source-dirs:
src
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -183,9 +184,10 @@ library hindent-internal
Paths_hindent
hs-source-dirs:
internal
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -217,9 +219,10 @@ executable hindent
Paths_hindent
hs-source-dirs:
app
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -252,10 +255,11 @@ test-suite hindent-test
Paths_hindent
hs-source-dirs:
tests
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, Diff
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -290,9 +294,10 @@ benchmark hindent-bench
Paths_hindent
hs-source-dirs:
benchmarks
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down
3 changes: 2 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ extra-source-files:
data-files: elisp/hindent.el
github: mihaimaruseac/hindent

ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded

dependencies:
- Cabal
- async
- base >= 4.7 && < 5
- bytestring
- containers
Expand Down
3 changes: 2 additions & 1 deletion src/HIndent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module HIndent
, HsModule'
) where

import Control.Concurrent.Async
import Control.Exception
import Control.Monad
import Data.ByteString (ByteString)
Expand Down Expand Up @@ -79,7 +80,7 @@ hindent args = do
then S8.interact
(either (error . prettyParseError) id
. reformat style exts Nothing)
else forM_ paths $ \filepath -> do
else forConcurrently_ paths $ \filepath -> do
cabalexts <- getCabalExtensionsForSourcePath filepath
text <- S.readFile filepath
case reformat style (cabalexts ++ exts) (Just filepath) text of
Expand Down
Loading