mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user