matansab matansab - 8 days ago 5
Java Question

Config IntelliJ switch case style

Intellij keeps formatting my switch case as follows:

switch (enumVal) {
case X:
//do stuff
break;
case Y:
//do stuff
break;
}


But I would like it to be formatted like Sun style:

switch (enumVal) {
case X:
//do stuff
break;
case Y:
//do stuff
break;
}


Is there a way to config that?

Answer

Go to Settings > Editor > Code Style > Java, select tab "Wrapping and Braces", scroll down the list to 'switch' statement, uncheck the option "Indent 'case' branches".

More information: IntelliJ 2016.3 Help - Code Style, Java