Skip to content

Conversation

@DavidGregory084
Copy link
Member

This makes it a lot easier to implement formatting for classic function call syntax like f(a, b, c), expanding to:

f(
  a,
  b,
  c
)

There are overloads of fold and intersperse for both Stream and Collection.
We also add a bracket overload that allows to specify the line separator document, providing a choice of replacement document when a layout is flattened e.g.

f( a, b, c ) // Doc.lineOrSpace

and

f(a, b, c) // Doc.lineOrEmpty

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Base: 98.10% // Head: 98.15% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (9b8ea31) compared to base (dea32e0).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##               main       #1      +/-   ##
============================================
+ Coverage     98.10%   98.15%   +0.04%     
- Complexity       44       51       +7     
============================================
  Files             1        1              
  Lines           264      271       +7     
  Branches         63       63              
============================================
+ Hits            259      266       +7     
  Misses            1        1              
  Partials          4        4              
Impacted Files Coverage Δ
...main/java/com/opencastsoftware/prettier4j/Doc.java 98.15% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@DavidGregory084 DavidGregory084 merged commit 4495023 into main Nov 10, 2022
@DavidGregory084 DavidGregory084 deleted the fold-intersperse-bracket branch May 31, 2024 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants