Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line breaks in "when" clause in SwitchExpression #382

Closed
pmccloghrylaing opened this issue Jul 28, 2021 · 1 comment · Fixed by #384
Closed

Line breaks in "when" clause in SwitchExpression #382

pmccloghrylaing opened this issue Jul 28, 2021 · 1 comment · Fixed by #384
Assignees
Milestone

Comments

@pmccloghrylaing
Copy link
Contributor

I came across some strange formatting of a long pattern statement with a when clause. I think CSharpier should prefer putting a line break before the when expression over breaking up the when condition.

Current behaviour:

someValue switch
{
    "SomeLongishValue______________________________________________" when count
        > 0
      => true
    _ => false
}

Expected behaviour:

someValue switch
{
    "SomeLongishValue______________________________________________"
        when count > 0
      => true
    _ => false
}

I did notice an improvement from 0.9.7 to 0.9.8, the previous formatting was:

someValue switch
{
    "SomeLongishValue______________________________________________" when count
    > 0 => true
    _ => false
}
@pmccloghrylaing
Copy link
Contributor Author

.assign

pmccloghrylaing added a commit to faktored/csharpier that referenced this issue Jul 29, 2021
shocklateboy92 pushed a commit that referenced this issue Jul 29, 2021
* Prefer breaking before `when` clause, instead of inside

Closes #382

* Use Group instead of GroupWithId
@belav belav added this to the 0.9.9 milestone Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants