-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[3889] Fix long lines with power operator(s) getting splitted before line length #3942
Conversation
diff-shades results comparing this PR (ba2cc11) to main (6f84f65). The full diff is available in the logs under the "Generate HTML diff report" step.
|
These all seem to be cases of erroneous line splitting getting fixed. |
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.
Thanks. This looks correct, but we'll have to make the change in the preview style only for now.
Ok, will do. Does this mean that the tests should also be reverted, as they will fail after the fix is behind |
You can add |
Description
Hugging power operators had a bug, where operators that end up hugging were still counted as not hugging when deciding to split the line. The bug is described here. The whole issue is a bit circular as we need to know the line length before we start to apply transformations. Calculating the hugging of power operators at the beginning of
transform_line
seems to do the trick. Ideally thehug_power_op
transform would be done only once, but switching the order of transforms broke a lot of other places, so I don't know if there's any other good options here.Checklist - did you ...
CHANGES.md
if necessary?