Skip to content
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

Open
homonoidian opened this issue Jun 29, 2024 · 0 comments
Open

Comments

@homonoidian
Copy link
Contributor

Bug Report

This:

macro x

end

if true    #
  a = "xy" #
end

... formats to this:

macro x
end

if true #
  a = "x   y" #
end

Macro with leading/trailing newlines. Code could be between the macro and ifs, in my case that was several hundred lines:

macro x

end

dofoo(1)
foodo(2)

if true    #
  a = "xy" #
end

... becomes:

macro x
end

dofoo(1)
foodo(2)

if true #
  a = "x   y" #
end

Similarly with multiple ifs:

macro x

end

if n0 #
  a = "xy" #
end

if n01 #
  a = "xy" #
end

if n012 #
  a = "xy" #
end

if n0123 #
  a = "xy" #
end

if n01234 #
  a = "xy" #
end

if n012345 #
  a = "xy" #
end

... formats to:

macro x
end

if n0 #
  a =      "xy" #
end

if n01 #
  a = "    xy" #
end

if n012 #
  a = "x   y" #
end

if n0123 #
  a = "xy  " #
end

if n01234 #
  a = "xy"  #
end

if n012345 #
  a = "xy" #
end

There's also this:

macro x
  
end

if 1 #
  foo #
  xyzzy = "hello world" #
end

... which formats to:

macro x
end

if 1 #
  foo                    #
  xyzz                  y = "hello world" #
end

... and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants