1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-10-06 01:47:10 +03:00
Commit Graph

42 Commits

Author SHA1 Message Date
Simon Hengel
9cdb3e93b0 Use it ".. instead of it "it .. 2023-01-02 14:15:42 +01:00
Alexander Esgen
54642a7966 Switch to ghc-lib-parser-9.4 2022-11-09 19:43:22 +01:00
Alexander Esgen
84a3f0eaba Cabal file lookup: fix handling of hs-source-dirs: . 2022-07-19 19:11:49 +02:00
Mark Karpov
25b04d45b4 Fix some bugs in the diff printing code 2022-05-15 22:11:41 +02:00
Mark Karpov
4b5ba705d7 Introduce operator fixity configuration
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2022-05-12 13:50:42 +02:00
Mark Karpov
d477a0be37 Rename Ormolu.Fixity.Types to Ormolu.Fixity.Internal
I think `Internal` makes it more obvious that the module is not part of the
public API (e.g. the data constructor of `LazyFixityMap` should normally
stay hidden).
2021-12-17 15:56:55 +01:00
Alexander Esgen
e3ad839959 Cache operator fixity maps 2021-12-17 14:37:44 +01: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
amesgen
11cda4c653 Switch to ghc-lib-parser-9.2 2021-11-16 18:16:46 +01:00
Thomas BAGREL
b889919794 Implement support for Backpack 2021-10-26 12:41:44 +02:00
Brandon Chinn
5548d632ae Control regeneration of test examples via an env variable 2021-10-16 12:34:25 +02:00
amesgen
0bb9363e61 Improve handling of .cabal files
See the changelog for details.
2021-09-23 15:41:42 +02:00
amesgen
897e6736ec Improve handling of disabled regions
Co-authored-by: kukimik <kukimik@poczta.onet.pl>
2021-09-13 22:22:55 +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
amesgen
bec43c1098 Detect missing trailing blank lines with --mode check 2021-08-07 16:28:05 +02:00
amesgen
92aec5077f Allow CLI GHC options to be overriden by file local options 2021-08-07 16:08:07 +02: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
Mark Karpov
5d1612f153 Replace “idempotency” with “idempotence” 2020-04-27 15:16:40 +02:00
Mark Karpov
21dd3775e7 Fix rendering of module headers 2020-04-24 20:21:35 +02:00
Avi Dessauer
c1ea571fd3 Bump version bounds 2020-01-22 19:15:43 +01:00
Yuriy Syrovetskiy
e91ced82c4 Fix HLint warnings 2019-11-18 20:30:05 +01:00
mrkkrp
480d6edfb3 Format Ormolu with Ormolu 2019-10-03 23:10:12 +02:00
mrkkrp
87406cbd8f Align opening/closing parentheses and other similar punctuation 2019-09-17 11:58:22 +02:00
mrkkrp
a3a93ebfef Refactor the comment rendering code and ‘newline’
This removes (or rather puts it to a lower level) logic around “modifying
newline” because it was very hard to reason about and almost blocked my work
on fixing issue #337.

I also dropped debugging output because it's too verbose and I'm not using
it anyway.

As part of these changes I also changed now the ‘newline’ combinator works.
Now, similar to ‘space’, the second ‘newline’ in a row just tells the
rendering engine to prefix next thing with a newline, using the ‘newline’
combinator more than twice in a row has no effect.

To take full advantage of the new feature I also went through the code and
simplified some logic around outputting exact amount of newlines because now
it's harder to get things wrong, so we can be less careful with counting
newlines.
2019-09-05 16:56:43 +02:00
mrkkrp
0233f6ddec Misc corrections 2019-08-11 16:04:42 +02:00
Utku Demir
b6c29bdf12 Handle OPTIONS_GHC and OPTIONS_HADDOCK pragmas
This change adds an ad-hoc parser for module pragmas to handle
OPTIONS_* pragmas. I did not want to use an existing tokenizer,
because I felt like tokenizing and pretty printing the GHC options
are more prone to error without providing much benefit.
2019-08-11 16:04:42 +02:00
Utku Demir
be6d09d148 Workaround GHC tokenizer bug while extracting LANGUAGE pragmas 2019-08-09 11:24:11 +02:00
mrkkrp
85d5f78b4b Change parens style and how separated lists of items are printed
Goals:

* Make the set of combinators clearer and smaller.
* Solve a number of issues, such as those about parse failures related to
  patterns.
* Solve the bug from #244.

The idea is very simple, we stop doing this

  ( foo
  , bar
  )

and start doing this

( foo,
  bar
  )

* We switch to trailing commas which solves the indentation issues for
  patterns automatically.
* The new general ‘sep’ combinator finally is clear enough, and all the old
  zoo of ‘velt’ and ‘velt'’ and ‘sepWith’, etc. which was confusing and
  overlapping goes away.
2019-08-04 13:32:06 +02:00
waddlaw
ae40a33507 Sort language pragmas and fix their placement in modules
The approach we take here is parsing of language pragmas on creation of
comment stream and then pretty-printing them in a separate block.
2019-07-05 20:03:31 +02:00
mrkkrp
c421b22832 Make test suite failures a bit more readable 2019-06-09 15:03:55 +02:00
mrkkrp
9a0276b36d Implement the rest of binding types
This includes pattern binds, pattern synonyms, and a refactoring around
printing ‘RdrName’s.
2019-06-04 00:49:33 +02:00
mrkkrp
09afebbd9c Implement rendering of simplest value-level constructs 2019-05-18 18:47:53 +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
00b08eeaff Implement rendering of data type declarations 2019-05-08 22:03:21 +02:00
mrkkrp
576f943e7f Implement rendering of types and type families declarations 2019-04-07 19:33:28 +02:00
mrkkrp
b6d49bb625 Implement pretty-printing of imports 2019-03-21 14:45:06 +01: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
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