From a4ec7d66eb94a651b739b057fd6e2b39552e8137 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:50:45 +0900 Subject: [PATCH] unindent dangling closing token --- src/services/formatting/formatting.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 78ddfa5c6e9..41630a77935 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -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),