JuliaFormatter.jl icon indicating copy to clipboard operation
JuliaFormatter.jl copied to clipboard

format for short begin end block

Open isaacsas opened this issue 2 years ago • 4 comments

In Catalyst.jl with SciMLStyle we are seeing that

rn = @reaction_network begin
     k/$V, A + B --> C
end k

gets formatted as

rn = @reaction_network begin k / $V, A + B --> C end k

Is there anything in SciMLStyle that could be changed / set to prevent this?

CC: https://github.com/SciML/SciMLStyle/issues/25

isaacsas avatar Aug 04 '22 18:08 isaacsas

so by default the first block is how it would be formatted. SciML overrides p_begin https://github.com/domluna/JuliaFormatter.jl/blob/master/src/styles/sciml/pretty.jl#L91-L118 which is it's being formatted the way it is.

@YingboMa wrote that bit afaik https://github.com/domluna/JuliaFormatter.jl/blame/598a2485bbd36a118c66b3774e73684c4a4e9697/src/styles/sciml/pretty.jl#L91-L118

domluna avatar Aug 04 '22 19:08 domluna

Thanks for the info! @YingboMa would you consider changing that to preserve the first form?

isaacsas avatar Aug 04 '22 19:08 isaacsas

I am also running into this. Was there a decision made?

3f6a avatar Aug 08 '23 12:08 3f6a

I think so

YingboMa avatar Aug 08 '23 14:08 YingboMa