Commit Graph

100 Commits (2cec32e6e11578221ec30e5fdee353d613d4b1f3)

Author SHA1 Message Date
Lennart Spitzner 2cec32e6e1 Fix bug in PRMMinimize feature for InfixN operators 2023-08-31 11:55:31 +00:00
Lennart Spitzner 9103ed55c2 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 11:55:31 +00:00
Lennart Spitzner 2ff31d5811 Fix let-in-expr non-idempotent comment placement 2023-08-31 11:55:31 +00:00
Lennart Spitzner 301f7cbbbd Add hardcoded fixity for aeson, Removing one clashing 2023-08-31 11:55:16 +00:00
Lennart Spitzner afa855c656 Implement new config flag UnknownOperatorHandling 2023-08-31 11:55:16 +00:00
Lennart Spitzner dbc4266f18 Fix import sorting 2023-08-28 15:26:16 +00:00
Lennart Spitzner d5f1deaa3d Stop duplicating commas for splices inside list 2023-06-26 15:53:26 +00:00
Lennart Spitzner b6da307ecc Stop using single-line layout for records defs with comms 2023-06-26 15:53:26 +00:00
Lennart Spitzner d3d3b90558 Hardcode two more operator precedences 2023-06-21 15:18:44 +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 49a2529a5b Fix exactprinting fallback for inline splice 2023-05-30 08:44:42 +00:00
Lennart Spitzner 4ed3a2f53d Fix a missing comment case with MultiWayIf 2023-05-29 21:00:10 +00:00
Lennart Spitzner 03e578f72c Refactor file/module structure again again 2023-05-29 20:44:01 +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 8706b55139 Properly handle comments at the end of imports 2023-05-28 13:55:21 +00:00
Lennart Spitzner a5f2178d87 Fix missing comments in record decl 2023-05-28 13:55:21 +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 b874175986 Fix no-module-header start-of-file whitespace 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 5ee0733f96 Add a few more hardcoded fixities 2023-05-28 13:55:20 +00:00
Lennart Spitzner a90550f62d Respect inline configs that happen to appear deep in AST
comments between top-level decls should be considered
for inline-config. But despite being placed between
top-level decls, occasionally they get connected
somewhere nested inside the AST of the first decl.
We fix this by extracting such comments in a
pre-processing step. The control flow was significantly
altered to allow for this;
before:
  parsing -> extract inline configs
          -> compute final config(s)
          -> split module into head/decls/comments/whitespace
          -> ... bridoc -> transformations -> printing
after:
  parsing -> split module into head/decl/comments/whitespace
          -> extract inline configs respecting comments that
             got extracted from decls in the previous step
          -> compute final config(s)
          -> ... bridoc -> transformations -> printing
2023-05-28 13:55:20 +00:00
Lennart Spitzner a9091daeb9 Improve layout options for newtype-decls
Also re-introduce the config flag to enable/disable
single-line newtype rhs layouting.
2023-05-18 15:42:48 +00:00
Lennart Spitzner 9c5a490938 Fix comment duplication on Matches 2023-05-18 15:42:48 +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 94fcf56b28 Teach obfuscation module new haskell keywords 2023-05-18 15:42:48 +00:00
Lennart Spitzner b057c49727 Include parse-error in output-not-valid error message 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 91300f5316 Respect empty lines after let keyword 2023-05-08 14:54:34 +00:00
Lennart Spitzner 687b59c62f Respect newlines before "where" 2023-05-08 14:54:34 +00:00
Lennart Spitzner 2b77142617 Fix layout of type-level list literal 2023-05-03 19:53:19 +00:00
Lennart Spitzner 84e703d7f3 Respect and Fix disable-next-binding/decl 2023-05-02 12:37:02 +00:00
Lennart Spitzner fe876ea0b0 Hardcode more precedences 2023-05-02 12:37:02 +00:00
Lennart Spitzner 884c7da97c Allow special layout for HsApp with HsDo/HsSpiceE args 2023-05-02 09:56:39 +00:00