Skip to content

Commit 15db964

Browse files
committed
Improve wrapping of enum values with no javadoc comment
Closes gh-313
1 parent 9b5b720 commit 15db964

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ org.eclipse.jdt.core.formatter.alignment_for_assignment=0
114114
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
115115
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
116116
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
117-
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
117+
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
118118
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
119119
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
120120
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.spring.javaformat.formatter;
2+
3+
public enum EnumWithManyUncommentedValues {
4+
5+
ONE("Long text value to force formatting of the enum's values across multiple lines"),
6+
TWO("Long text value to force formatting of the enum's values across multiple lines"),
7+
THREE("Long text value to force formatting of the enum's values across multiple lines"),
8+
FOUR("Long text value to force formatting of the enum's values across multiple lines"),
9+
FIVE("Long text value to force formatting of the enum's values across multiple lines"),
10+
SIX("Long text value to force formatting of the enum's values across multiple lines");
11+
12+
private String text;
13+
14+
EnumWithManyUncommentedValues(String text) {
15+
this.text = text;
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.spring.javaformat.formatter;
2+
3+
public enum EnumWithManyUncommentedValues {
4+
5+
ONE("Long text value to force formatting of the enum's values across multiple lines"),
6+
TWO("Long text value to force formatting of the enum's values across multiple lines"),
7+
THREE("Long text value to force formatting of the enum's values across multiple lines"),
8+
FOUR("Long text value to force formatting of the enum's values across multiple lines"),
9+
FIVE("Long text value to force formatting of the enum's values across multiple lines"),
10+
SIX("Long text value to force formatting of the enum's values across multiple lines");
11+
12+
private String text;
13+
14+
EnumWithManyUncommentedValues(String text) {
15+
this.text = text;
16+
}
17+
18+
}

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
@@ -17,7 +17,7 @@ core.formatter.alignment_for_compact_if=16
1717
core.formatter.alignment_for_compact_loops=16
1818
core.formatter.alignment_for_conditional_expression=16
1919
core.formatter.alignment_for_conditional_expression_chain=0
20-
core.formatter.alignment_for_enum_constants=0
20+
core.formatter.alignment_for_enum_constants=16
2121
core.formatter.alignment_for_expressions_in_array_initializer=16
2222
core.formatter.alignment_for_expressions_in_for_loop_header=0
2323
core.formatter.alignment_for_logical_operator=16

0 commit comments

Comments
 (0)