ceylon-ide-eclipse
ceylon-ide-eclipse copied to clipboard
Wrong indentation for let / if-then-else expressions
The new let and if then else expressions allow doing some nesting like this :
function buildParents(String entry)
=> let(parents = entry.split('/'.equals).filter(not(String.empty)).exceptLast)
if (exists firstParent = parents.first)
then
if (nonempty restOfParents = parents.rest.sequence())
then restOfParents.scan(firstParent + "/")(
(path, nextParent) => "".join { path, nextParent + "/"})
else { firstParent + "/"}
else {};
However the Correct Indentation action (as well as the automatic indentation applied after copy/paste) formats it like that :
function buildParents(String entry)
=> let(parents = entry.split('/'.equals).filter(not(String.empty)).exceptLast)
if (exists firstParent = parents.first)
then
if (nonempty restOfParents = parents.rest.sequence())
then restOfParents.scan(firstParent + "/")(
(path, nextParent) => "".join { path, nextParent + "/"})
else { firstParent + "/"}
else {};
@gavinking any thought about that and about the corresponding formatter issue ?
@davidfestal This one is really pretty impossible unless we get the parser involved in the AutoEdit, which is something we don't currently depend on. I just committed a sorta partial solution, but I left it commented out, since it doesn't really work quite right.