Skip to content

Weird indentation on patterns in switch #1084

@belav

Description

@belav

The current behavior looks kinda wrong. But indenting a single time like 2 looks worse.
I think going with 3 and 4 would make sense, I believe we have other instances where extra indentation is added.

switch (currentDoc)
{
    // 1. current formatting
    case LeadingComment
    or TrailingComment:
        if (output.Length > 0 && currentMode is not PrintMode.ForceFlat)
            returnFalseIfMoreStringsFound = true;
        break;
    // 2. indenting a single time lines it up with the body
    case LeadingComment
        or TrailingComment:
        if (output.Length > 0 && currentMode is not PrintMode.ForceFlat)
            returnFalseIfMoreStringsFound = true;
        break;
    // 3. should probably not break for this case
    case LeadingComment or TrailingComment:
        if (output.Length > 0 && currentMode is not PrintMode.ForceFlat)
            returnFalseIfMoreStringsFound = true;
        break;
    // 4. but if it gets long enough to break, maybe a double indent?
    case LeadingComment
            or TrailingComment:
        if (output.Length > 0 && currentMode is not PrintMode.ForceFlat)
            returnFalseIfMoreStringsFound = true;
        break;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions