New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1627 [18]: FormatOps: ignore line breaks in infix expressions #1855
Conversation
@olafurpg @tanishiking @poslegm PTAL. This turned out to be the most complex problem, took me almost 3 weeks. I know @olafurpg tried solving this before and eventually gave up; I tried to track down all previous issues relating to infix handling and take them into account. I think the end result is reasonable albeit not always optimal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your tremendous work!
One question and one nitpicking
scalafmt-core/shared/src/main/scala/org/scalafmt/internal/SplitTag.scala
Outdated
Show resolved
Hide resolved
c53ce57
to
c21cbf0
Compare
Involves choosing the right RHS for it and handle it similarly to other infix types.
Add the
newlines.afterInfix
parameter to allow formatting of infix expressions and optionally breaking lines after an infix operation (which appears to be always safe, unlike before it); enable it fornewlines.source=fold,unfold
. The behaviour and specific parameters/values will be defined in a separate PR containing the documentation.Helps with #1627.
scala-repos
diffs:unfold
: kitbellew/scala-repos@6377998fold
: kitbellew/scala-repos@1a055b5unfold
: kitbellew/scala-repos@edbae8c