Align SciML Dict tuple pairs#999
Conversation
|
This is another slightly nuanced one... (1) It shouldn't join the (2) I don't think there's any style where pair arrows are forced to align. There is the a => b
cccc => ddddwon't be converted to a => b
cccc => dddd. However, if it's already in that latter format, then This does actually behave correctly (kind of) -- I've tweaked this input so that julia> s = """
algorithm_cases = Dict(
"default search" => (),
"with static scheduler" => (backend=StaticBackend(),),
"with spline kernel" => (smoothing_length=1.1 * item_spacing,
smoothing_kernel=SplineKernel{2}())
)
"""
"algorithm_cases = Dict(\n \"default search\" => (),\n \"with static scheduler\" => (backend=StaticBackend(),),\n \"with spline kernel\" => (smoothing_length=1.1 * item_spacing,\n smoothing_kernel=SplineKernel{2}())\n)\n"
julia> s |> println
algorithm_cases = Dict(
"default search" => (),
"with static scheduler" => (backend=StaticBackend(),),
"with spline kernel" => (smoothing_length=1.1 * item_spacing,
smoothing_kernel=SplineKernel{2}())
)
julia> format_text(s, SciMLStyle(); align_pair_arrow=true) |> println
algorithm_cases = Dict(
"default search" => (),
"with static scheduler" => (backend = StaticBackend(),),
"with spline kernel" => (smoothing_length = 1.1 * item_spacing,
smoothing_kernel = SplineKernel{2}())
)So the alignment is behaving correctly, although the indentation of All in all, I think there are some bugs here, but I'm not sure they're the same bugs that the PR tries to fix. |
|
There could also be a flag that says "yes really force the alignment even if it's not already aligned to begin with" -- that'd be a separate config option though that would apply across all styles. |
Before:
After: