SourceKit/Indentation: align function names in chained trailing closures

Chained trailing closures are sibling-like thus they should be aligned.

rdar://22205716
This commit is contained in:
Xi Ge
2019-06-10 17:01:46 -07:00
parent ce3a5d14c7
commit c7cf96660a
2 changed files with 49 additions and 0 deletions

View File

@@ -481,6 +481,24 @@ public:
}
}
// Chained trailing closures shouldn't require additional indentation.
// a.map {
// ...
// }.filter { <--- No indentation here.
// ...
// }.map { <--- No indentation here.
// ...
// }
if (AtExprEnd && AtCursorExpr && isa<CallExpr>(AtExprEnd)) {
if (auto *UDE = dyn_cast<UnresolvedDotExpr>(AtCursorExpr)) {
if (auto *Base = UDE->getBase()) {
if (exprEndAtLine(Base, Line))
return false;
}
}
}
// Indent another level from the outer context by default.
return true;
}