Here, the #= comment =# gets shifted to the next line:
julia> s = """
f() do x #= comment =#
g
end
"""
"f() do x #= comment =#\n g\nend\n"
julia> ft(s) |> println
f() do x
#= comment =#
g
end
This is another case where the structure of the raw CST emitted by JuliaSyntax makes things a bit tricky to work with, and would be solved by a refactor akin to #1032. In particular, the comment is parsed as part of the block rather than part of the tuple. JuliaFormatter inserts a forced newline between the tuple and the block, which is usually completely sensible, just not here:
julia> fs(:cst, s)
1:32 │[call]
1:1 │ Identifier ✔
2:2 │ (
3:3 │ )
4:32 │ [do]
4:4 │ Whitespace
5:6 │ do
7:8 │ [tuple]
7:7 │ Whitespace
8:8 │ Identifier ✔
9:29 │ [block]
9:9 │ Whitespace
10:22 │ Comment
23:27 │ NewlineWs
28:28 │ Identifier ✔
29:29 │ NewlineWs
30:32 │ end
Here, the
#= comment =#gets shifted to the next line:This is another case where the structure of the raw CST emitted by JuliaSyntax makes things a bit tricky to work with, and would be solved by a refactor akin to #1032. In particular, the comment is parsed as part of the
blockrather than part of thetuple. JuliaFormatter inserts a forced newline between thetupleand theblock, which is usually completely sensible, just not here: