Skip to content

Commit 3d9559e

Browse files
committed
Improve indentation of switch cases
Closes spring-iogh-336
1 parent 666583e commit 3d9559e

File tree

3 files changed

+27
-1
lines changed
  • spring-javaformat
    • spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse
    • spring-javaformat-formatter-tests/src/test/resources

3 files changed

+27
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class SwitchExample {
2+
3+
protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
4+
switch (getErrorProperties().getIncludeBindingErrors()) {
5+
case ALWAYS:
6+
return true;
7+
case ON_PARAM:
8+
return getErrorsParameter(request);
9+
default:
10+
return false;
11+
}
12+
}
13+
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class SwitchExample {
2+
protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces) {
3+
switch (getErrorProperties().getIncludeBindingErrors()) {
4+
case ALWAYS:
5+
return true;
6+
case ON_PARAM:
7+
return getErrorsParameter(request);
8+
default:
9+
return false;
10+
}
11+
}
12+
}

spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ core.formatter.indent_empty_lines=false
101101
core.formatter.indent_statements_compare_to_block=true
102102
core.formatter.indent_statements_compare_to_body=true
103103
core.formatter.indent_switchstatements_compare_to_cases=true
104-
core.formatter.indent_switchstatements_compare_to_switch=false
104+
core.formatter.indent_switchstatements_compare_to_switch=true
105105
core.formatter.indentation.size=4
106106
core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
107107
core.formatter.insert_new_line_after_annotation_on_field=insert

0 commit comments

Comments
 (0)