julia-vscode / DocumentFormat.jl

Auto-formatter for Julia
Other
62 stars 18 forks source link

Add "Prettier"-like options #66

Closed ValentinKaisermayer closed 2 years ago

ValentinKaisermayer commented 4 years ago

I find the vscode extension Prettier quite good. Especially one option:

Fit code within this line limit

Is it possible to include such a behavior into the Julia formatter?

For example the following code snippet is 116 columns long.

optimizer_factory = JuMP.with_optimizer(Gurobi.Optimizer, env, LogToConsole = 0, MIPGap = 0.01, DualReductions = 0)

It should be formatted into:

optimizer_factory = JuMP.with_optimizer(
    Gurobi.Optimizer, 
    env, 
    LogToConsole = 0, 
    MIPGap = 0.01, 
    DualReductions = 0)

and not:

optimizer_factory = JuMP.with_optimizer(Gurobi.Optimizer, 
    env, 
    LogToConsole = 0, 
    MIPGap = 0.01,
    DualReductions = 0)

I feel.