-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Formatter inserts unexpected whitespace in if
with comments after macro
#14767
Labels
Comments
kamil-gwozdz
added a commit
to kamil-gwozdz/crystal
that referenced
this issue
Jul 21, 2024
kamil-gwozdz
added a commit
to kamil-gwozdz/crystal
that referenced
this issue
Jul 21, 2024
I wrote a failing spec for it: kamil-gwozdz@bdc5756 I think the problem is that crystal/src/compiler/crystal/tools/formatter.cr Lines 5061 to 5075 in 0cef61e
# lines
["macro x", "end", "", "if true #", " a = \"xy\" #", "end"] # 6 elements
# @comment_columns
[nil, nil, nil, nil, 8, 11, nil, nil] # 8 elements I guess it's due to how macros are handled. |
It seems like empty lines were removed from |
kamil-gwozdz
added a commit
to kamil-gwozdz/crystal
that referenced
this issue
Jul 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
This:
... formats to this:
Macro with leading/trailing newlines. Code could be between the macro and
if
s, in my case that was several hundred lines:... becomes:
Similarly with multiple ifs:
... formats to:
There's also this:
... which formats to:
... and so on.
The text was updated successfully, but these errors were encountered: