Lennart Spitzner
812957dca4
Implement merging of imports
...
I.e. not merging of items inside one import, but merging
imports of the same module (and the same qualified name,
if present etc.)
2023-08-31 14:42:49 +02:00
Lennart Spitzner
7d84705e7a
Fix let-in-expr non-idempotent comment placement
2023-08-31 11:59:35 +00:00
Lennart Spitzner
28e3ec18a3
Implement new config flag UnknownOperatorHandling
2023-08-31 13:59:29 +02:00
Lennart Spitzner
b6da307ecc
Stop using single-line layout for records defs with comms
2023-06-26 15:53:26 +00:00
Lennart Spitzner
9737cb3adc
Allow case-of Blockargument operand with par-spacing
2023-06-21 13:04:34 +00:00
Lennart Spitzner
9d14407191
Fix interaction of do-block with ExprWithTySig
2023-06-21 09:26:36 +00:00
Lennart Spitzner
628ab81bc9
Set proper indentation base level for operands
2023-06-20 17:06:50 +00:00
Lennart Spitzner
a6e187e962
Fix multiline-list indentation past comma level
2023-06-20 17:06:50 +00:00
Lennart Spitzner
278e0275f2
Allow parspacing for lambdacase after operator
2023-06-20 17:06:50 +00:00
Lennart Spitzner
7bbbea728d
Fix another two comment spacing special-cases using hacks
...
Whole thing is ugly. Exactprint decided to not include a proper
delta for that one comment, so needed a special workaround that
then needs special exceptions too.
The whole thing is a mess at this point and needs a re-think.
At least we now have a proper test-suite for these kinds of
problems.
2023-05-30 11:29:40 +00:00
Lennart Spitzner
4ed3a2f53d
Fix a missing comment case with MultiWayIf
2023-05-29 21:00:10 +00:00
Lennart Spitzner
b3f8317e99
Fix minimize-parens feature, Add a few basic tests
2023-05-29 20:44:01 +00:00
Lennart Spitzner
54043ca9ba
Fix empty do-block error call
2023-05-29 20:44:01 +00:00
Lennart Spitzner
10dc48b74d
Do not retain newlines when refactoring list into single line
2023-05-29 20:44:01 +00:00
Lennart Spitzner
48522b596c
Fix end-of-decl comment spacing issue
2023-05-29 20:44:01 +00:00
Lennart Spitzner
5e5433f33a
Fix PRMMinimize behaviour on simple paren'ed expressions
2023-05-29 20:44:01 +00:00
Lennart Spitzner
5481e5015f
Make use of OpTree for type (signature) layouting, Fix layout
...
Some more cases that still produced broken layout on interaction
with do-blocks were fixed.
2023-05-29 20:44:01 +00:00
Lennart Spitzner
d4f49f9ced
Fix one more block-comment restore-position issue
2023-05-28 13:55:21 +00:00
Lennart Spitzner
8f69d5e816
Fix bad indentation problem for HsMultiIf inside parens
2023-05-28 13:55:21 +00:00
Lennart Spitzner
6721a44359
Retain comments after lambdacase and at record fields
2023-05-28 13:55:21 +00:00
Lennart Spitzner
adc74d8bb1
Fix paren-multiline-expression in do block
2023-05-28 13:55:21 +00:00
Lennart Spitzner
3b431cdad2
Fix invalid syntax on nested do-block with comment
2023-05-28 13:55:21 +00:00
Lennart Spitzner
91a8c23989
Fixup op prec testcase
2023-05-28 13:55:20 +00:00
Lennart Spitzner
e38836fdab
Fix top-level comment position+whitespace bug
2023-05-18 15:42:48 +00:00
Lennart Spitzner
860c8771ae
Fix issue with indentation after block-comments
2023-05-18 15:42:48 +00:00
Lennart Spitzner
6008cb26ac
Support basic form of HsBangTy
2023-05-18 15:42:48 +00:00
Lennart Spitzner
7e56701bc2
Support associated data decls with multiple constructors
2023-05-18 15:42:48 +00:00
Lennart Spitzner
7bf2879ac0
Deny one layout for OpApp cases unless precedence<=1
...
Previously allowed: `foo = abc + def-as-par`
Still allowed: `foo = abc $ def-as-par`
Still allowed: `foo = abc <&> \x -> def-as-par`
2023-05-08 15:15:14 +00:00
Lennart Spitzner
e7cdff440d
Fix space between paren and multi-line lambda
2023-05-08 15:15:14 +00:00
Lennart Spitzner
2b77142617
Fix layout of type-level list literal
2023-05-03 19:53:19 +00:00
Lennart Spitzner
884c7da97c
Allow special layout for HsApp with HsDo/HsSpiceE args
2023-05-02 09:56:39 +00:00
Lennart Spitzner
ab67a794db
Fix retaining newlines between do statements
2023-05-02 09:56:39 +00:00
Phil Hazelden
52bde7910f
Support promoted type applications.
...
Closes #370 .
Up to GHC 8.10,
foo @ 'Bar
was a valid type application. In GHC 9 it's not, which means brittany
needs to allow
foo @'Bar
which it now does.
The reason the space was needed was to allow a promoted type variable at
the head of a type-level list. That is,
'['Foo]
is invalid syntax, because it initially parses as the character `'['`.
So the promoted type variable was always given a separator at the
beginning, and we'd get
'[ 'Foo]
which was valid. Now we handle this case by specifically examining the
head of a type-level list; if it's promoted we introduce spaces, so
'[ 'Foo ]
'[Foo]
I've added tests for this and some related cases. In doing so I noticed
that unnecessary spaces get added in front of commas in these lists; I
believe that's a separate bug, and I've written a comment explaining why
it happens, but I haven't tried to fix it.
I'm not sure when the first alternates in the `FirstLastSingleton`
and `FirstLast` branches would ever be hit, so I'm not entirely sure if
the separators are necessary there. But since `docSeparator` disappears
at the end of a line and merges with adjacent separators, they should be
harmless.
2023-05-02 09:56:39 +00:00
Lennart Spitzner
7ab6a207ae
Update OpApp layouting options
...
- Allow par-spacing for single-operator 1+n-line layout
- Tweak when to flatten operators, i.e. when to allow a flat one-line-each
layout for the operator sequence "$ $ $ + +".
2023-05-02 09:16:44 +00:00
Lennart Spitzner
99e5aacb5e
Discard special case for non-nested OpApp
2023-05-02 09:16:04 +00:00
Lennart Spitzner
d29303d4cd
Improve one HsLet layout
...
- Allow parSpacing for single-clause layout
- Allow par/sl layout when no where-clause was present
(not sure why this was disabled in the first place)
2023-05-02 09:16:04 +00:00
Lennart Spitzner
09ec59eaf9
Fix comment-after-context
2023-05-02 09:16:04 +00:00
Lennart Spitzner
2fef44559e
Fix comments moving after "where"
2023-05-02 09:16:04 +00:00
Lennart Spitzner
676695a609
Implement fixity-aware-ops feature
2023-05-02 09:16:03 +00:00
Lennart Spitzner
f13a82964a
Partially restore retaining-empty-lines behaviour
...
Currently works for do blocks, multi-line list literals, and
lambda-case cases (apart from top-level blank lines that
never got ignored).
2023-05-02 09:16:03 +00:00
Lennart Spitzner
05270ecb45
Improve block-comment behaviour (newlines after or not)
2023-05-02 09:16:03 +00:00
Lennart Spitzner
83b13d61a0
Change behaviour: Less par-spacing for function application
2023-05-02 09:16:03 +00:00
Lennart Spitzner
d9373ec80e
Implement extension support - OverloadedRecordDot
2023-05-02 09:16:03 +00:00
Lennart Spitzner
d11141d34d
Refactor+Rewrite+Adaptation for ghc-9.2 support
2023-05-02 09:16:03 +00:00
Lennart Spitzner
bff9bfb312
Support and use nested file structure for tests
2023-05-02 09:16:03 +00:00
Lennart Spitzner
4e397441b9
Revert "Split tests into individual files"
...
This reverts commit 21e86adf6e
.
2023-05-02 09:16:00 +00:00
Taylor Fausak
21e86adf6e
Split tests into individual files
2021-11-23 22:41:01 +00:00
Taylor Fausak
89a9f47b72
Ignore warnings when parsing modules
2021-11-21 23:40:15 +00:00
Taylor Fausak
ab59e9acc3
Parse modules "purely", without ghc-paths
2021-11-21 22:58:07 +00:00
Taylor Fausak
cdc8405b10
Remove mentions of GHC 8.x
2021-11-21 13:59:35 +00:00