unindent dangling closing token

This commit is contained in:
Kagami Sascha Rosylight 2016-12-21 21:50:45 +09:00
parent cddc72a25e
commit a4ec7d66eb

View File

@ -496,10 +496,19 @@ namespace ts.formatting {
case SyntaxKind.WhileKeyword:
case SyntaxKind.AtToken:
return indentation;
default:
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
case SyntaxKind.SlashToken:
case SyntaxKind.GreaterThanToken: {
if (container.kind === SyntaxKind.JsxOpeningElement ||
container.kind === SyntaxKind.JsxClosingElement ||
container.kind === SyntaxKind.JsxSelfClosingElement
) {
return indentation;
}
break;
}
}
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
},
getIndentation: () => indentation,
getDelta: child => getEffectiveDelta(delta, child),