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

LoadError: MethodError: no method matching length(::Nothing)

Open YingboMa opened this issue 4 years ago • 5 comments

https://github.com/SciML/ModelingToolkit.jl/pull/1007/checks?check_run_id=2553550888#step:6:411

YingboMa avatar Jun 12 '21 04:06 YingboMa

@YingboMa what options did you run this with?

domluna avatar Jun 12 '21 15:06 domluna

It should be clear with the tests. It just uses the default options. Also, ModelingToolkit still fails with https://github.com/julia-vscode/CSTParser.jl/pull/288

YingboMa avatar Jun 19 '21 20:06 YingboMa

julia> JuliaFormatter.format_text("var\"##iv#469\" = (@variables(t))[1]")
ERROR: KeyError: key 0:0 not found
Stacktrace:
 [1] getindex
   @ ~/.julia/packages/DataStructures/ixwFs/src/sorted_dict.jl:196 [inlined]
 [2] cursor_loc
   @ ~/.julia/packages/JuliaFormatter/0Eaux/src/state.jl:19 [inlined]
 [3] format_text(cst::CSTParser.EXPR, style::DefaultStyle, s::JuliaFormatter.State)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:353
 [4] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:346
 [5] #format_text#173
   @ ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:338 [inlined]
 [6] format_text
   @ ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:336 [inlined]
 [7] #format_text#172
   @ ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:332 [inlined]
 [8] format_text(text::String)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/0Eaux/src/JuliaFormatter.jl:332
 [9] top-level scope
   @ REPL[40]:1

YingboMa avatar Jun 19 '21 21:06 YingboMa

@YingboMa I have a fix for the above and tagging a new version

domluna avatar Jun 20 '21 02:06 domluna

@YingboMa is this solved with the lastest version?

domluna avatar Aug 21 '21 16:08 domluna