Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.7
-
Fix Version/s: 2.0.2Release
-
Component/s: Formatting
-
Labels:None
-
Environment:Eclipse 3.4
-
Patch Submitted:Yes
-
Number of attachments :
Description
The new code formatting option is a big improvement, but is not yet usable for me if some improvements are not added. What I noticed:
result.getFailures().each
{
def testHeader = it.getTestHeader()
def currentTestName = testHeader.substring(testHeader.indexOf("(") + 1, testHeader.indexOf(")"))
println testHeader
it.getTrace().split("\n").eachWithIndex
{
line, i ->
if (line.contains(currentTestName) || 0 == i)
{
println line
}
}
}
gets formatted as
result.getFailures().each
{
def testHeader = it.getTestHeader()
def currentTestName = testHeader.substring(testHeader.indexOf("(") + 1, testHeader.indexOf(")"))
println testHeader
it.getTrace().split("\n").eachWithIndex
{ line, i -> if (line.contains(currentTestName) || 0 == i) { println line } }
}
Thus the { gets an indentation like it was a wrapped line after the .each method. For me this should not be the case, I consider .each with a closure argument almost like a for loop.
Problems also happen on eachWithIndex, and for some reason
is on the same line - I would like it to be on another line.
Feel free to contact me for more details.
Hi Jean-Noël
Thanks for your feedback. A comment to the behavior of the formatter. There are two strategies which are working together. A "beautifier" an an "Indentor" The Beautifier tries to combine simple closures, with only one statement, to one line closures. I'm working on the feature, that the user can specify when this reduce to one line should be done.
If you only like to get the Indentation to be fixed use the specific function for this. Ctrl + I