-
Notifications
You must be signed in to change notification settings - Fork 36
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
[regression] shrinking function heads to 1-line moving comments between if stanzas #67
Comments
the function head in question is split over multiple lines, so this is likely a regression in function-head shrinking |
i have a theory that this occurs when we try to shrink the function head, but ultimately the formatter disallows the shrink - so it's like
soooo, a problem resulting from our lazy shrinks? only fix in that case would be to do the heavy lifting of making the document algebra for each head and attempting to shrink it. at that point, might be easier to see if we can modify things upstream in formatter itself to support this collapsing 🤔 then again, if this theory was correct the comments would move up with every run of |
Also reproduceable with def my_function(
very_long_name,
so_long_that_this_head_will_not_fit_on_one_line
) do
result =
case foo do
:bar -> :baz
:baz -> :bong
end
# My comment
Context.process(result)
end will become def my_function(
very_long_name,
so_long_that_this_head_will_not_fit_on_one_line
) do
result =
case foo do
:bar ->
:baz
:baz ->
:bong
# My comment
end
Context.process(result)
end |
wow thanks andrew. for some reason your simple case made me have an epiphany around what's actually going wrong here. i've got a fix coming =) |
fixed in 0.10.1 |
I have a very large file where a new comment was being moved when nothing else was. The file's so big I'm unsure how to create a minimal repro at this point, but the statements were fairly deeply nested within a function
The text was updated successfully, but these errors were encountered: