You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems to occur for broadcast expressions with more than two arguments within a getindex. Possibly related to #537. MWE:
julia>format_text("a[1 .+ 1]") # okay"a[1 .+ 1]"
julia>format_text("1 .+ 1 .+ 1") # okay outside of getindex"1 .+ 1 .+ 1"
julia>format_text("a[1 .+ 1 .+ 1]") # fails
ERROR: Error while PARSING formatted text:1 a[1.+1.+1]
...
Error occurred on line 1, offset 11 of formatted text.
The error might not be precisely on this line but it should be in the region of the code block. Try commenting the region out and see if that removes the error.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] format_text(cst::CSTParser.EXPR, style::DefaultStyle, s::JuliaFormatter.State)
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:314
[3] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:243
[4] #format_text#253
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:215 [inlined]
[5] format_text
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:212 [inlined]
[6] #format_text#252
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:209 [inlined]
[7] format_text(text::String)
@ JuliaFormatter ~/.julia/packages/JuliaFormatter/r97Ka/src/JuliaFormatter.jl:208
[8] top-level scope
@ REPL[39]:1
Based on the expression a[1 .+ 1.+1] in the error message, it seems to be deleting space between 1 and .+, leading to the invalid expression 1.+1. In fact, adding parentheses fixes the issue:
julia> format_text("a[1 .+ (1) .+ 1]") # works with extra parenthesis
"a[1 .+ (1).+1]" # note (1).+1 in output, i.e. spaces deleted
The text was updated successfully, but these errors were encountered:
Seems to occur for broadcast expressions with more than two arguments within a
getindex
. Possibly related to #537. MWE:Based on the expression
a[1 .+ 1.+1]
in the error message, it seems to be deleting space between1
and.+
, leading to the invalid expression1.+1
. In fact, adding parentheses fixes the issue:The text was updated successfully, but these errors were encountered: