Skip to content

fix(match): Indent match conditions#2258

Merged
czosel merged 1 commit intoprettier:mainfrom
claytonrcarter:indent-match-condition
Oct 11, 2023
Merged

fix(match): Indent match conditions#2258
czosel merged 1 commit intoprettier:mainfrom
claytonrcarter:indent-match-condition

Conversation

@claytonrcarter
Copy link
Copy Markdown
Contributor

This updates match($cond) printing to ... er ... match if ($cond) (etc) when the condition can't fit onto a single line.

Input

match($really_really_really_really_really_really_really_really_long_variable_name) {
default => null
};

Current behavior on master

match(
$really_really_really_really_really_really_really_really_long_variable_name
) {
    default => null
};

Behavior with this change

match(
    $really_really_really_really_really_really_really_really_long_variable_name
) {
    default => null
};

I added a test to the snapsnots, and this change also corrects/changes one of the other match snapshots.

Copy link
Copy Markdown
Collaborator

@cseufert cseufert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and looks good

Copy link
Copy Markdown
Collaborator

@czosel czosel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well, thanks for contributing and sorry for the delay!

@czosel czosel merged commit f6fbc45 into prettier:main Oct 11, 2023
@claytonrcarter claytonrcarter deleted the indent-match-condition branch October 11, 2023 22:27
@czosel
Copy link
Copy Markdown
Collaborator

czosel commented Oct 15, 2023

Released in v0.21.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants