Inconsistent line breaks with binary operators
sloede opened this issue · comments
Michael Schlottke-Lakemper commented
With SciML-style formatting, it seems like there is inconsistent line breaking introduced that depends on the type of binary operator. MWE:
julia> using JuliaFormatter
julia> text = """
a = (1 + 2 + 3
- 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15)
b = (1 + 2 + 3
+ 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15)
""";
julia> println(text)
a = (1 + 2 + 3
- 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15)
b = (1 + 2 + 3
+ 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15)
julia> println(format_text(text; style = SciMLStyle(), margin=40))
a = (1 + 2 + 3
-
4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 +
12 + 13 + 14 + 15)
b = (1 + 2 + 3
+ 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 +
12 + 13 + 14 + 15)
IMHO, the formatting for a
with the leading -
is wrong, since it leaves a single -
on an otherwise empty line. If the problematic line starts with a +
instead, all is peachy.