Skip to content

Commit 92e3b3b

Browse files
committed
remove isIndentPreventedChildNode
1 parent 56fc7ec commit 92e3b3b

1 file changed

Lines changed: 2 additions & 27 deletions

File tree

src/services/formatting/formatting.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ namespace ts.formatting {
389389

390390
let indentation = inheritedIndentation;
391391
if (indentation === Constants.Unknown) {
392-
if (isIndentPreventedChildNode(parent.kind, node.kind)) {
392+
if (parent.kind === SyntaxKind.JsxElement && node.kind === SyntaxKind.JsxClosingElement) {
393+
// JsxClosingElement should not be indented
393394
indentation = parentDynamicIndentation.getIndentation();
394395
}
395396
else if (isSomeBlock(node.kind)) {
@@ -1021,32 +1022,6 @@ namespace ts.formatting {
10211022
return false;
10221023
}
10231024

1024-
function isIndentPreventedChildNode(parent: SyntaxKind, child: SyntaxKind) {
1025-
switch (parent) {
1026-
case SyntaxKind.JsxElement: {
1027-
return child === SyntaxKind.JsxClosingElement;
1028-
}
1029-
}
1030-
}
1031-
1032-
function isIndentPreventedCoreComponent(child: SyntaxKind) {
1033-
switch (child) {
1034-
// open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
1035-
case SyntaxKind.OpenBraceToken:
1036-
case SyntaxKind.CloseBraceToken:
1037-
case SyntaxKind.OpenBracketToken:
1038-
case SyntaxKind.CloseBracketToken:
1039-
case SyntaxKind.OpenParenToken:
1040-
case SyntaxKind.CloseParenToken:
1041-
case SyntaxKind.ElseKeyword:
1042-
case SyntaxKind.WhileKeyword:
1043-
case SyntaxKind.AtToken:
1044-
case SyntaxKind.JsxClosingElement:
1045-
return true;
1046-
}
1047-
return false;
1048-
}
1049-
10501025
function getOpenTokenForList(node: Node, list: Node[]) {
10511026
switch (node.kind) {
10521027
case SyntaxKind.Constructor:

0 commit comments

Comments
 (0)