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
Crash when formatting case
and macro for
#8633
Comments
It is not a valid macro, you can't do that. As documented here: Macros
You can do this:
|
Technically, the code is valid because the expanded macro is empty. But of course, it doesn't make sense because you can't do anything useful with it. Still, since it's valid syntax, the formatter should be able to handle it. We could also consider making an outer macro expansion directly following a |
Also this fails to format: case
1
end The above is equivalent to: case 1
end In the original snippet it's the same. I wonder if we should disallow the condition case condition to be in a separate line... it looks pretty weird. Same goes for |
@asterite I would have never assumed that a newline would be appropriate at the location. So 👍 Especially for case, which can go without an expression, it looks confusing. |
So only use case I could think of is when the expression is very long and you want to split it into serveral lines, it makes sense to start all lines at the same column. But the formatter already takes care of that, at least for if a_long_conditional_expression &&
another_even_longer_expression &&
this_is_the_longest_expression_of_them_all
body
end
unless a_long_conditional_expression &&
another_even_longer_expression &&
this_is_the_longest_expression_of_them_all
body
end But not with case a_long_conditional_expression &&
another_even_longer_expression &&
this_is_the_longest_expression_of_them_all
when foo
body
end |
The text was updated successfully, but these errors were encountered: