Lambda expressions with leading/trailing comments are now broken and indented properly. Also, lambda expressions in general are formatted more similarly to Prettier JavaScript.
Example
Input
class Example {
void example() {
System.out.println(
List.of(1, 2, 3).stream().map(
// a very long comment which explains the beatifullness of multiplication by 2
// yes this is very important
v -> v * 2
).collect(Collectors.summingInt(v -> v))
);
}
void example() {
System.out.println(
List.of(1, 2, 3).stream().map(
v -> v * 2
// a very long comment which explains the beatifullness of multiplication by 2
// yes this is very important
).collect(Collectors.summingInt(v -> v))
);
}
}
Output
class Example {
void example() {
System.out.println(
List.of(1, 2, 3)
.stream()
.map(
// a very long comment which explains the beatifullness of multiplication by 2
// yes this is very important
v -> v * 2
)
.collect(Collectors.summingInt(v -> v))
);
}
void example() {
System.out.println(
List.of(1, 2, 3)
.stream()
.map(
v -> v * 2
// a very long comment which explains the beatifullness of multiplication by 2
// yes this is very important
)
.collect(Collectors.summingInt(v -> v))
);
}
}
What changed with this PR:
Lambda expressions with leading/trailing comments are now broken and indented properly. Also, lambda expressions in general are formatted more similarly to Prettier JavaScript.
Example
Input
Output
Relative issues or prs:
Closes #581