Skip to content

[prism] Fix splitting logic for aref grouping#757

Merged
reese merged 1 commit intotrunkfrom
reese-aref-indentation
Jan 5, 2026
Merged

[prism] Fix splitting logic for aref grouping#757
reese merged 1 commit intotrunkfrom
reese-aref-indentation

Conversation

@reese
Copy link
Collaborator

@reese reese commented Jan 5, 2026

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.)

Copy link
Collaborator

@froydnj froydnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked this on Stripe's codebase, but the tests look like they do the right thing.

@froydnj
Copy link
Collaborator

froydnj commented Jan 5, 2026

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 🎉 .

@reese reese merged commit 9dab972 into trunk Jan 5, 2026
8 checks passed
@reese reese deleted the reese-aref-indentation branch January 5, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[prism] extra indentation for array index expressions in the middle of call chains

2 participants