-
Notifications
You must be signed in to change notification settings - Fork 278
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
RedundantBraces: remove nested braces in lambda #1549
RedundantBraces: remove nested braces in lambda #1549
Conversation
@olafurpg @tanishiking my first submission, please take a look. I am also working on another but will likely need some guidance, can't figure out splits/policies/decisions. I will send a draft for comments shortly. |
LGTM 👍 I want to test it for regressions on large codebase with #1551. I'll try to do it by the end of the week. |
@poslegm @tanishiking thanks for taking a look. On my side, I tested on |
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 @kitbellew Only one blocking comment, otherwise LGTM 👍
Can you maybe link to a diff in scala-repos with the changes from this PR? We could share the diff in the release notes to give people a better understanding of the changes.
scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala
Outdated
Show resolved
Hide resolved
@olafurpg @tanishiking @poslegm here's a fork of https://github.com/kitbellew/scala-repos/commits/scalafmt-1549 |
76d94ed
to
1012a25
Compare
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.
@olafurpg @tanishiking @poslegm
The example diffs can be found here: https://github.com/kitbellew/scala-repos/commits/scalafmt-1549
Apparently, if you add ?w=1
to a commit's url, it will ignore whitespace changes (of which there are a lot there).
scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala
Outdated
Show resolved
Hide resolved
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.
The diff in scala repos looks great!
scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala
Outdated
Show resolved
Hide resolved
1012a25
to
a687053
Compare
@@ -15,6 +17,8 @@ case class RewriteCtx( | |||
implicit val dialect = style.runner.dialect | |||
def isMatching(a: Token, b: Token) = | |||
matchingParens.get(TokenOps.hash(a)).contains(b) | |||
|
|||
val activeForEdition_2019_11: Boolean = style.activeFor(Edition(2019, 11)) |
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.
as requested, created a field for this flag
a687053
to
96ea0fb
Compare
@@ -192,6 +192,13 @@ case class ScalafmtConfig( | |||
continuationIndent.callSite, | |||
continuationIndent.defnSite | |||
) | |||
|
|||
// Edition-specific settings below |
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.
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.
@olafurpg @tanishiking @poslegm please take a look. let me know if there's anything else. i published a link to scala-repos
diff earlier.
96ea0fb
to
128fdeb
Compare
@olafurpg @poslegm @tanishiking at the risk of sounding impatient, i wonder if there's anything else you'd like to see. i would like to merge this and #1551 first, and then work on the other changes (I have half a dozen in pipeline, with a couple already submitted for review). |
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.
LGTM! Sorry for delay, I'm pretty busy at job now.
Thank you very much for your big effort! I will try to review the rest of your PRs soon.
@olafurpg I took the responsibility to merge this PR because yours requested changes have been implemented. If you have another remarks we can do it separately. |
Example diffs: https://github.com/kitbellew/scala-repos/commits/scalafmt-1549