julia-emacs icon indicating copy to clipboard operation
julia-emacs copied to clipboard

indentation with DataFrames.jl pipelines

Open tcovert opened this issue 5 years ago • 1 comments

When writing data cleaning pipelines, I often find that single step requires more than 80 characters to do right, and to maintain readability, I split the expression over multiple lines. When I start a new pipeline expression, I would like to be able to have the indentation begin back at the original "left-most" point. For example, when I face this problem with dplyr in R, using emacs/ESS, I get indentation that looks like this: image

However, the equivalent code in emacs/Julia-mode delivers indentation that looks like this: image

Is this intended behavior? Is there a setting I can change to make Julia-mode indent this pipeline the way ESS indents the equivalent pipeline in R?

tcovert avatar Apr 01 '21 02:04 tcovert

JuliaFormatter always starts from the indentation of the last scope when indenting nested expression like pipes

if true
    a |>
    b |>
    c |>
    d
end

julia-mode indentation function instead further indents subsequent pipes

if true
    a |>
        b |>
        c |>
        d
end

also for ternary operators JuliaFormatter

if true
    a ?
    b :
    c ?
    d :
    f
end

julia-mode

if true
    a ?
        b :
        c ?
        d :
        f
end

untoreh avatar Feb 03 '22 08:02 untoreh