Skip to content

"Lone" else lines are not properly indented #73

@yohannd1

Description

@yohannd1

By "lone" else lines, I mean lines in if statements that only have whitespace and the else keyword. They're usually around when there is a multi-line if condition that isn't directly made up of blocks.

For an actual example on what is happening - I typed this code from top to bottom using automatic indentation:

const a = if (cond)
    val1
    else
    val2;

pub fn main() void {
    const b = if (cond)
        val1
        else
            val2;
}

What I expect to happen is the following:

const a = if (cond)
    val1
else
    val2;

pub fn main() void {
    const b = if (cond)
        val1
    else
        val2;
}

NOTE: I was previously working on this under the #59 PR, but got stuck and don't really know where to go anymore, so I'm leaving it up for anyone who may be able to tackle this in a better way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions