[SourceKit][CodeFormat] When indent to siblings, respect tuple elements' names. rdar://24251847

This commit is contained in:
Xi Ge
2016-01-20 10:46:31 -08:00
parent 69ba5bc876
commit a65ffab3e7
2 changed files with 28 additions and 2 deletions

View File

@@ -1894,8 +1894,11 @@ class FormatWalker: public ide::SourceEntityWalker {
// Trailing closures are not considered siblings to other args.
unsigned EndAdjust = TE->hasTrailingClosure() ? 1 : 0;
for (unsigned I = 0, N = TE->getNumElements() - EndAdjust; I < N; I ++) {
addPair(TE->getElement(I)->getEndLoc(),
FindAlignLoc(TE->getElement(I)->getStartLoc()), tok::comma);
auto EleStart = TE->getElementNameLoc(I);
if (EleStart.isInvalid()) {
EleStart = TE->getElement(I)->getStartLoc();
}
addPair(TE->getElement(I)->getEndLoc(), EleStart, tok::comma);
}
}