Skip to content

Indentation is too aggressive for ternary operator #3676

Open
@JsonFreeman

Description

@JsonFreeman

Actual:

var v =
    0 ? 1 :
        2 ? 3 :
            4;

Expected:

var v =
    0 ? 1 :
    2 ? 3 :
    4;

I believe the fix is that if the false branch of the ternary operator should have the same indentation as the true branch. In the case where the true branch is on the same line as the condition, it should not be considered indented, and therefore the false branch should not be indented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterDomain: Smart IndentationAutomatic indenting after a newline (not quite formatter/formatting)Good First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions