Hello,
I was trying to figure how to configure the format tool for Groovy in order to have pretty looking chained closures.
Unfotunatelly I can't manage to get what I want.
Do you know how can I achieve the following (or something close to it):
Expected:
void sample() {
List<String> list = [/*init data here*/]
list.grep {
String s ->
s.size() > 3 && s.size() < 6
}
.each {
String s ->
s.reverse()
}
}
But once format called I have that:
void sample() {
List<String> list = [/*init data here*/]
list.grep {
String s ->
s.size() > 3 && s.size() < 6
}
.each {
String s ->
s.reverse()
}
}
Problem 1) I would like to have some indent after the closure parameters (this is a minor problem)
Problem 2) The second closure is drawn in the middle of the code, so I would like to have the call de-indented. And the closure code should be indented as any other code block instead of being aligned on the call itself.
Do you know any good format config to avoid such messy looking code ?
Thanks.