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),