[prism] Fix splitting logic for aref grouping#757
Merged
Conversation
froydnj
approved these changes
Jan 5, 2026
Collaborator
froydnj
left a comment
There was a problem hiding this comment.
I haven't checked this on Stripe's codebase, but the tests look like they do the right thing.
Collaborator
|
And FWIW, the recent spate of performance improvements (0.11.211 - > 0.11.233) seem to improve whole-codebase formatting with ripper by ~25% on Stripe's codebase 🎉 . |
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.
Closes #713
I kinda goofed the logic on grouping arefs as part of a segment when I first wrote this. We shouldn't split before an aref -- we should instead split after that aref, and we also would want to split after all the arefs in that group. This was causing all the "trailing aref" logic to not work quite as expected so arefs were still getting rendered inside a breakable (hence the extra indentation).
It was unclear to me if we preferred the indentation of the Prism or Ripper implementations, but IMO we should shoot for the same output first and then we can adjust the formatting later if we want -- I'd rather that be an intentional choice and not an accident. (Even then, I think this is more correct and would make an intentional choice to further indent it ~trivial.)