Skip to content

Commit a4ec7d6

Browse files
committed
unindent dangling closing token
1 parent cddc72a commit a4ec7d6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/services/formatting/formatting.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,19 @@ namespace ts.formatting {
496496
case SyntaxKind.WhileKeyword:
497497
case SyntaxKind.AtToken:
498498
return indentation;
499-
default:
500-
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
501-
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
499+
case SyntaxKind.SlashToken:
500+
case SyntaxKind.GreaterThanToken: {
501+
if (container.kind === SyntaxKind.JsxOpeningElement ||
502+
container.kind === SyntaxKind.JsxClosingElement ||
503+
container.kind === SyntaxKind.JsxSelfClosingElement
504+
) {
505+
return indentation;
506+
}
507+
break;
508+
}
502509
}
510+
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
511+
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
503512
},
504513
getIndentation: () => indentation,
505514
getDelta: child => getEffectiveDelta(delta, child),

0 commit comments

Comments
 (0)