Do not break switch case

Is there a way to keep case and return in a switch statement on the same line?

Currently if I format the code, it breaks after the ":" :

But I would like to keep it like this:

 

Any suggestions?

5

There's no such option.

You can:

1) submit this as a feature request to our tracker at https://youtrack.jetbrains.com/newIssue

2) enable Formatter Control (the tab) at Preferences/Settings | Editor | Code Style. And add //@formatter:off and //@formatter:on comments surrounding the regions you don't want IDE to mess with

0

2 years later, same Question?!?

0

Unfortunately, it is still impossible, here is a ticket to vote for:
https://youtrack.jetbrains.com/issue/WI-48433

I will leave a link to this forum thread to its internal comments to increase the ticket weight.

1

请先登录再写评论。