Skip to content

Unnecessary split in switch expression after comment #1215

@munificent

Description

@munificent

A line comment before a case in a switch expression seems to force it to split when it otherwise wouldn't need to. The formatter currently produces:

    return switch (level) {
      0 => a,
      // Comment.
      1
          when flag =>
        b,
    };

    return switch (level) {
      0 => a,
      1 when flag => b,
    };

Both should have the same formatting for the 1 when flag => b case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions