Commit Graph

70 Commits

Author SHA1 Message Date
Mark Karpov
ca83f15869 Implement merging on imports 2020-06-22 16:31:26 +02:00
Mark Karpov
be1eac66c3 Implement merging of the items in import sections 2020-06-19 17:39:23 +02:00
Mark Karpov
e09fcc0316 Fix the bug related to de-association of pragma comments 2020-06-18 13:59:04 +02:00
Mark Karpov
3fc444a70b Fixed the bug in the de-duplicating algorithm for import lists 2020-06-17 16:50:32 +02:00
Mark Karpov
35f4fb3932 Deal with non-zero indentation in region formatting
Improved region formatting so that indented fragments can also be processed
correctly.
2020-06-16 14:20:52 +02:00
Mark Karpov
cc337bda18 Prevent type applications from gluing to TH splices that follow them 2020-06-15 12:12:23 +02:00
Mark Karpov
a877785709 Preserve blank lines in ‘let’ and ‘where’ bindings 2020-06-15 10:56:03 +02:00
Mark Karpov
d5a5bf66c0 Fix rendering of function arguments in multiline layout 2020-06-10 15:14:46 +02:00
Mark Karpov
2efc5d37f9 Format linked lists with colon as line terminator
This adds support for a formatting style described here:

<https://wiki.haskell.org/List_notation>
2020-06-10 14:31:07 +02:00
Mark Karpov
903d8d9eef Avoid outputting trailing whitespace in multiline comments 2020-06-04 16:50:47 +02:00
Mark Karpov
2b1d013d7c Put operators after other names
Previously ‘RdrName’s were sorted by simple comparison of their names.
However, in ASCII not all “operator-like” symbols go after alpha-numeric
characters. This resulted in this sort of output:

  import Linear.Vector ((*^), Additive (..), (^*))

The new ordering scheme allows us to separate operators and other names:

  import Linear.Vector (Additive (..), (*^), (^*))
2020-06-03 17:39:12 +02:00
Mark Karpov
67e43e0057 Handle magic comments for disabling/enabling with more flexibility 2020-06-03 15:28:57 +02:00
Jonas
9e11a5c1b2 Remove duplicate LIE's from import lists 2020-05-26 12:04:53 +02:00
Mark Karpov
5f631015b0
Fix a typo in the changelog
[skip ci]
2020-05-25 21:04:46 +02:00
Mark Karpov
409c1f9aa8
Version bump (0.1.0.0)
[skip ci]
2020-05-25 20:49:06 +02:00
Mark Karpov
8eac6bb7a0 Fix an idempotence issue with operators chains 2020-05-25 16:19:37 +02:00
Mark Karpov
1fb65a218c Fix non-idempotent transformation of partly documented data definition 2020-05-15 12:21:27 +02:00
Mark Karpov
76c4f523d7 Fix rendering of unnamed fields of data constructors 2020-05-13 15:37:07 +02:00
Mark Karpov
a5c4d6c439 Improve rendering of comments around if expressions 2020-05-11 16:47:37 +02:00
Mark Karpov
06173266c6
Mention the fix for 518 in the changelog 2020-05-11 14:59:20 +02:00
Mark Karpov
60752a2853 Fixed an idempotence issue in type synonym and data declarations 2020-05-07 19:29:52 +02:00
Mark Karpov
eb8bccd469
Fix a typo in the changelog 2020-05-06 23:15:16 +02:00
Mark Karpov
0abedcce03 Prevent the equality sign from “disconnecting” comments
This resolves a class of idempotence issues when the equality sign happens
to be inserted between an element and its comment that follows on the same
line. I had to special-case equality sign for this, because all alternative
approaches (changing comment association logic or trying to find a more
general rule) did not work or fixed this issue yet made other things worse.

There is nothing special about the equality sign per se, but it (always?)
starts definitions which have their own ‘Located’ wrappers and it is those
spans interfere with the logic of comment association (they are detected as
AST elements between the “host” element and its comment) on subsequent
passes. This results in non-idempotent formatting.

The solution is OKish in that it fixes 99% of problems that one will
encounter in practice, but I see how an input can be crafted to show that
there is still an issue with idempotence.
2020-05-06 23:03:57 +02:00
Mark Karpov
194da3a19f Fix the difference in indentation levels in a comment series 2020-05-05 14:05:24 +02:00
Mark Karpov
991bf8e24d Prevent incorrect detection of continuations of comment series 2020-05-04 19:02:42 +02:00
Mark Karpov
22839ed74c Improve tracking of dirty lines, better hang expressions in records 2020-04-29 18:12:42 +02:00
Mark Karpov
5d1612f153 Replace “idempotency” with “idempotence” 2020-04-27 15:16:40 +02:00
Mark Karpov
bc621311dd
Mention the fix for 566 in the changelog 2020-04-26 22:48:04 +02:00
Mark Karpov
fc64eada5c
Version bump (0.0.5.0)
[skip ci]
2020-04-24 20:23:36 +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
dde7560291 Allow disabling of Ormolu with special comments
Ormolu can be turned on and off via the special comments:

{- ORMOLU_DISABLE -}

and

{- ORMOLU_ENABLE -}

This allows us to disable formatting selectively for code between these
markers or disable it for the entire file. To achieve the latter, just put
{- ORMOLU_DISABLE -} at the very top. Note that the source code should still
be parseable even without the “excluded” part. Because of that the magic
comments cannot be placed arbitrary, but should rather enclose independent
top-level definitions.
2020-04-21 12:44:39 +02:00
Mark Karpov
2fa7078346
Mention grouping of TH splices in the changelog
[skip ci]
2020-04-20 14:54:03 +02:00
Mark Karpov
490720fedc Preserve comments on pragmas 2020-04-17 17:01:34 +02:00
Mark Karpov
145f7296f5 Preserve grouping of do statements 2020-04-16 20:41:36 +02:00
Mark Karpov
683cbeacf5
Version bump (0.0.4.0)
[skip ci]
2020-04-15 15:52:50 +02:00
Mark Karpov
9874ac7ce7
Some minor edits to the changelog
[skip ci]
2020-04-14 22:41:47 +02:00
Mark Karpov
d09429f6ec Format records with a single data constructor more compactly 2020-04-10 18:02:26 +02:00
Mark Karpov
d96f7e3e00 Do not lump together forall and constructors when deciding on layout 2020-04-10 14:37:15 +02:00
Mark Karpov
9b342488be Render type applications similar to value applications 2020-04-10 14:37:15 +02:00
Mark Karpov
9b7b6eb239 Fix rendering of arrow notation with multiline expressions 2020-04-10 12:42:05 +02:00
Mark Karpov
5acda489e8
Add the recent changes to the changelog
[skip ci]
2020-04-09 18:37:02 +02:00
Mark Karpov
ac719f3e99 Improve rendering of "where" in class declarations and such 2020-02-10 11:21:34 +01:00
Mark Karpov
84c2a53349 More compact rendering of type family injectivity constraints 2020-02-01 20:03:41 +01:00
Mark Karpov
a37765cbcb Make rendering of operator patterns consistent with other cases 2020-01-31 14:36:40 +01: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
d1c7606cab
Version bump (0.0.3.1)
[skip ci]
2020-01-22 19:17:34 +01:00
Mark Karpov
ca8cb0474a
Add a mention of the issue 498 to the changelog
[skip ci]
2020-01-17 12:06:43 +01:00
Mark Karpov
3137345dc3
Version bump (0.0.3.0)
[skip ci]
2020-01-11 13:06:12 +01:00