Java – configure the case style of the IntelliJ switch
•
Java
IntelliJ keeps formatting my switch case as follows:
switch (enumVal) {
case X:
//do stuff
break;
case Y:
//do stuff
break;
}
But I want it to be formatted in Sun Style:
switch (enumVal) {
case X:
//do stuff
break;
case Y:
//do stuff
break;
}
Is there any way to configure it?
Solution
Go to Settings > Edit > code style > in Java, select the "wrapping and branches" tab, scroll down the list to the "switch" statement, and uncheck the "indent 'case' branches" option
More information: IntelliJ 2016.3 help – code style, Java
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
