SciML Style
JuliaFormatter.SciMLStyle
— TypeSciMLStyle()
Formatting style based on SciMLStyle.
This style is still work-in-progress.
Configurable options with different defaults to DefaultStyle
are:
always_for_in
= truedisallow_single_arg_nesting
= truejoin_lines_based_on_source
= truenormalize_line_endings
= unixremove_extra_newlines
= trueshort_to_long_function_def
= truetrailing_comma
= falsewhitespace_ops_in_indices
= truewhitespace_typedefs
= trueyas_style_nesting
= false
Configuration File Example
The .JuliaFormatter.toml
which represents these settings is
style = "sciml"
Or to use SciMLStyle
except change one of the settings:
style = "sciml"
remove_extra_newlines = false
Direct Usage
format("file.jl", SciMLStyle())
Or to use SciMLStyle
except change one of the settings:
format("file.jl", SciMLStyle(), remove_extra_newlines=false)
Additional Options
The SciMLStyle
supports the additional options variable_call_indent
and yas_style_nesting
.
The option variable_call_indent
is set to []
by default. It allows calls without aligning to the opening parenthesis:
# Allowed with and without `Dict in variable_call_indent`
Dict{Int, Int}(1 => 2,
3 => 4)
# Allowed when `Dict in variable_call_indent`, but
# will be changed to the first example when `Dict ∉ variable_call_indent`.
Dict{Int, Int}(
1 => 2,
3 => 4)
The option yas_style_nesting
is set to false
by default. Setting it to true
makes the SciMLStyle
use the YASStyle
nesting rules:
# With `yas_style_nesting = false`
function my_large_function(argument1, argument2,
argument3, argument4,
argument5, x, y, z)
foo(x) + goo(y)
end
# With `yas_style_nesting = true`
function my_large_function(argument1, argument2,
argument3, argument4,
argument5, x, y, z)
foo(x) + goo(y)
end