Avoid nesting LHS if not over margin and if RHS can be nested#1012
Draft
penelopeysm wants to merge 2 commits into
Draft
Avoid nesting LHS if not over margin and if RHS can be nested#1012penelopeysm wants to merge 2 commits into
penelopeysm wants to merge 2 commits into
Conversation
Contributor
8bc405d to
05a1d1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an alternative solution for #998. Note: This PR is a bit too far-reaching to be really merged right now. It essentially does what the comments say. If we have a binary expression
LHS op RHS, we try to avoid nesting the LHS if there is any point in theop RHSsegment where we can nest it.This leads to much improved output in some cases, for example, that in #998. However, it also causes some regressions. For example this causes
when previously it would be formatted instead to
I still think that the solution in this PR is the correct way to deal with the nesting preference, but it needs to be more tightly scoped to avoid causing regressions in other cases that we aren't trying to improve.