-
Notifications
You must be signed in to change notification settings - Fork 50
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
Handle arbitrary expression types in aref_field
nodes
#381
Conversation
a[ | ||
class A | ||
def foo | ||
puts(a) | ||
end | ||
end | ||
] = "" | ||
a[ | ||
begin | ||
"" | ||
rescue StandardException | ||
"" | ||
end | ||
] = "" |
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.
I'm gonna call this a "reasonable" rendering? I mean, users writing this is already pretty surprising, so I think this is the most consistent way to handle it rather than special-casing aref fields to inline these or something like that 🤷♂️
self.line_numbers.len() > 1 || self.any_collapsing_newline_has_heredoc_content() | ||
self.line_numbers.len() > 1 | ||
|| self.any_collapsing_newline_has_heredoc_content() | ||
|| self.contains_hard_newline() |
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.
I also think this was a latent bug we've had around forever -- some expressions are essentially always multiline (e.g. classes), so breakables that have these in them should always render multiline.
Resolves #380
aref_field
nodes (e.g.foo[:bar] = :baz
) can really handle any expression in the index position, and in reality they can handle any number of items for users overriding#[]=
, so we should handle an arbitrary expression list here.