domluna / JuliaFormatter.jl

An opinionated code formatter for Julia. Plot twist - the opinion is your own.

Home Page:https://domluna.github.io/JuliaFormatter.jl/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with `#! format: noindent` and comments

sloede opened this issue · comments

There seem to be some slight hiccups with the newly added (#724) #! format: noindent that concerns comments:

Comments not attached to a (non-indented) code entity will actually get indented. The - from what I can tell - correctly formatted snippet

begin
#! format: noindent

# This is OK
function foo end

# This is not

end

turns into

begin
#! format: noindent

# This is OK
function foo end

  # This is not

end

Even weirder, the following

begin
#! format: noindent

end

is turned into

begin
  #! format: noindent

end

Is this a feature or a bug?

looks like a bug to me

Unfortunately, I am not sure how to dig deeper on this but I'd be happy to assist with testing etc if helpful.