ziglang / zig-mode

Zig mode for Emacs
GNU General Public License v3.0
166 stars 55 forks source link

Indentation function doesn't handle if expressions well #78

Closed michaelbartnett closed 1 year ago

michaelbartnett commented 1 year ago

I don't have my config setup to format on save so I rely on the mode indentation a lot, and it currently will produce this:

fn sign(i: i32) i32 {
    return if (i == 0)
        0
        else if (i > 0)
        -1
        else
        -1;
}

While the preferred style according to zig fmt would be:

fn sign(i: i32) i32 {
    return if (i == 0)
        0
    else if (i > 0)
        -1
    else
        -1;
}