[ANN] JuliaFormatter.jl

Well, it seems to break the example I posted above.

That’s because the formatter assumes positional arguments with default args are used directly prior to keyword arguments. Since you have a positional argument with no default argument after one with a default argument, when the semicolon is added the code breaks.

basically you shouldn’t be calling function like f(b=1, 0, c=3) when you mean f(0, b=1, c=3), but I guess it is indeed a bug since Julia parsed this correctly.

The fix to your specific problem is to have your positional argument at front:

html_div([dcc_dropdown(id = "input-id0", options = [Dict(("label" => "some text"), ("value" => "AA")), Dict("label" => "something else"), ("value" => "pdc")], style=Dict("width"=>"300px"), value="AA",multi = false)])

Thanks. I realized this (now). I suppose the question is: how many other people out there might use a non canonical order of arguments and use JuliaFormatter on such code.

1 Like

Hey all, just want to plug v0.17 which is a bigger update than usual. It includes two new options

trailing_comma (defaults to true). Related to added/removing/doing nothing with respect to trailing commas.

and

join_lines_based_on_source (defaults to false). This one is pretty big! It gives you more control on how lines are joined, while still adhering to the style and margin.

The README file in the github repo now has all the options listed there which is much more accessible.

With these changes we’re one step closer to integrating with VSCode

11 Likes