1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-08-16 08:20:40 +03:00
Commit Graph

52 Commits

Author SHA1 Message Date
Michael Peyton Jones
ae8808105b Add locking around text output 2024-07-11 23:24:56 +02:00
Michael Peyton Jones
7c6355b6df Format files in parallel
There is no explicit configuration for this, but it is possible for users to
override by changing the RTS options to the `ormolu` executable.
2024-07-11 23:24:56 +02:00
Alexander Esgen
9de2dfaa52 Use Data.Text.IO.Utf8 from text-2.1 2024-05-21 19:31:59 +02:00
Mark Karpov
6cf491c5ca Prioritize fixity overrides and module re-exports from command line 2024-02-01 21:31:13 +01:00
Mark Karpov
9fabd8cfe1 Support explicit package names in module re-exports in .ormolu
Support explicit mention of target package name in module re-exports. Even
if the exported package is not specified as a direct dependency of the
component being formatted it will be taken into account correctly.
2023-06-05 21:36:24 +02:00
Mark Karpov
83509ebd1a Locate .ormolu file independently of .cabal files 2023-05-17 21:22:01 +02:00
Mark Karpov
8f2bc36705 Allow to specify module re-exports in .ormolu files
It turns out that gaining knowledge of all module re-exports in the
ecosystem is tricky because the Hoogle database does not contain this
information, so one would need to download all 14+k packages from Hackage
and parse their source code. We've decided that perhaps hardcoding some
common re-exports and otherwise giving the users a way to make Ormolu aware
of arbitrary important re-exports is a satisfactory solution for now.

Co-authored-by: amesgen <alexander.esgen@tweag.io>
2023-05-15 20:43:41 +02:00
Mark Karpov
badafc0452 Implement a more precise inference of fixity information 2023-04-24 14:39:33 +02:00
Alexander Esgen
c8f4afde2b Switch to GHC2021, remove redundant pragmas 2023-03-31 21:13:35 +02:00
Mark Karpov
c81320d8a1 Expose a more complete API from the Ormolu module
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2023-01-25 20:27:25 +01:00
Alexander Esgen
f0b8690ae1 Use Text as formatting input 2023-01-23 18:30:21 +01:00
Alexander Esgen
45eaf2a838 Don't use String for operator and package names 2023-01-23 18:30:21 +01:00
Alexander Esgen
4b0bcc2945 Flakeify
also drop Ormolu Live temporarily
2023-01-23 18:10:02 +01:00
Mark Karpov
4b5ba705d7 Introduce operator fixity configuration
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2022-05-12 13:50:42 +02:00
Thomas BAGREL
1f63136d04 Operator chain overhaul
See the changelog for details.

Co-authored-by: Alexander Esgen <alexander.esgen@tweag.io>
Co-authored-by: Mark Karpov <mark.karpov@tweag.io>
2021-12-16 16:23:57 +01:00
Thomas BAGREL
b889919794 Implement support for Backpack 2021-10-26 12:41:44 +02:00
Mark Karpov
a320d99583 Allow check mode when working with stdin input 2021-09-30 10:58:46 +02:00
Mark Karpov
27f3f8e046
Keep FILE arguments at the end of the CLI help text 2021-08-14 16:27:44 +02:00
amesgen
59fced3058 Add option to respect default-extensions from .cabal files 2021-08-12 18:22:21 +02:00
amesgen
3f52afa1d3 Read and write text files using UTF8 and ignoring native line ending 2021-08-11 14:42:21 +02:00
Mark Karpov
a63ded8397
Simplify the definition of ‘optParserInfo’ 2020-12-11 22:06:38 +01:00
Mark Karpov
ff9d64db24 Add ‘--color’ for controlling how diffs are printed
Also refactor the printing code and standardize how error messages are
output.
2020-11-15 20:50:38 +01:00
Mark Karpov
93bef509ca Display diffs in the checking mode
Also improve the way the diffs are printed.
2020-11-14 16:44:16 +01:00
Samir Talwar
e95ec9b83b Avoid modifying correctly-formatted files
Currently, when running with `--mode=inplace`, Ormolu always overwrites the
files, even when nothing has changed, updating the modified timestamp of the
file. This encourages Stack to rebuild everything when only one file has
changed.

A quick check to see if the file needs rewriting solves this problem.

I would prefer the API allowed me to only read the file once, but as the
`--mode=check` logic also reads the file twice, I decided this wasn't the
biggest sin for now.
2020-09-06 20:37:55 +02:00
Mark Karpov
e5bbfddfa3 Add ‘-i’ as a shortcut for ‘--mode inplace’ 2020-06-26 10:58:38 +02:00
Mark Karpov
5d1612f153 Replace “idempotency” with “idempotence” 2020-04-27 15:16:40 +02:00
Mark Karpov
d579a48f48
Give start/end line variables better names in the help text 2020-04-24 23:10:23 +02:00
Mark Karpov
21dd3775e7 Fix rendering of module headers 2020-04-24 20:21:35 +02:00
Mark Karpov
840acd908b Allow selection of a region to format 2020-04-24 19:01:30 +02:00
Mark Karpov
53f582a575
Implement experimental support for CPP 2020-04-22 14:47:09 +02:00
Mark Karpov
31f6cfd83f Compare failing logs with exact expected result
This will allow us to test on more code and catch changes in the logs as
they happen.
2020-04-15 15:00:08 +02:00
Mark Karpov
d09429f6ec Format records with a single data constructor more compactly 2020-04-10 18:02:26 +02:00
Utku Demir
34dc1cba49 Don't give up on first failure when multiple files are given
Closes #502.
2020-01-30 13:43:59 +01:00
Mark Karpov
a9f8926c8d Format the source of the application as well 2020-01-24 16:42:21 +01:00
Artyom Kazak
b08af17217 Migrate to ‘ghc-lib-parser’
This would let us have features from GHC 8.8.1 while still using GHC 8.6.5
from Nixpkgs. Bonus: Ormolu will be compilable with GHCJS.
2019-11-01 18:19:34 +01:00
mrkkrp
10232b9c86
Sort extensions that should be manually enabled 2019-09-02 17:10:08 +02:00
mrkkrp
d74b211f1e
A couple of minor tweaks (command line options parser) 2019-08-28 16:21:43 +02:00
mrkkrp
3a093e65c8 Support formatting multiple files at once 2019-08-16 23:06:05 +02:00
Utku Demir
da0b3b8565 Implement the --check-idempotency flag 2019-08-16 22:21:20 +02:00
mrkkrp
c5b9fa1168 Add an option to tolerate CPP pragmas 2019-07-14 13:14:55 +02:00
waddlaw
e663070623 An option to display “manual” extensions 2019-07-13 21:42:06 +02:00
mrkkrp
c201862f11 Drop ‘yaml’ configuration 2019-07-07 13:53:59 +02:00
Tuncer Ayaz
cad7e40ae5 Allow reading from stdin 2019-07-07 12:25:22 +02:00
Basile Henry
42c91987bf Use explicit error code in check mode 2019-06-19 21:28:22 +02:00
mrkkrp
b9c8b64947 Implement more precise comment placement without ‘ghc-exactprint’
‘ghc-exactprint’ (or perhaps lexer of GHC itself) does a fairly poor job at
associating comments with elements of AST. In many cases the result is not
what you'd expect. We ran into insuperable problems with that to the effect
that correct comment placement were impossible.

The new approach is to exploit the raw position information provided by the
GHC lexer, that is, spans attached to AST elements and comments. This
allowed us to place comments in output in a very precise and satisfactory
fashion.
2019-05-08 22:03:21 +02:00
mrkkrp
6f169f2969 Include debugging option in ‘Config’ 2019-02-28 22:22:10 +01:00
mrkkrp
2f73bae977 Implement CLI for the application 2019-02-28 22:22:10 +01:00
mrkkrp
b2e05d6f65 Throw exception when CPP is enabled (plus some refactoring) 2019-02-28 22:22:10 +01:00
mrkkrp
120b4caefc Implement handling of comments and printing of module headers 2019-02-21 18:15:27 +01:00
mrkkrp
fcd35a1faa Implement pretty printing combinators 2019-01-28 19:26:13 +01:00