From 92e3b3b5faad8531d381e54c5856879b29d6d3c0 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Wed, 26 Aug 2015 01:06:37 +0900 Subject: [PATCH] remove isIndentPreventedChildNode --- src/services/formatting/formatting.ts | 29 ++------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 9a91c85db0b..a3b32099cca 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -389,7 +389,8 @@ namespace ts.formatting { let indentation = inheritedIndentation; if (indentation === Constants.Unknown) { - if (isIndentPreventedChildNode(parent.kind, node.kind)) { + if (parent.kind === SyntaxKind.JsxElement && node.kind === SyntaxKind.JsxClosingElement) { + // JsxClosingElement should not be indented indentation = parentDynamicIndentation.getIndentation(); } else if (isSomeBlock(node.kind)) { @@ -1021,32 +1022,6 @@ namespace ts.formatting { return false; } - function isIndentPreventedChildNode(parent: SyntaxKind, child: SyntaxKind) { - switch (parent) { - case SyntaxKind.JsxElement: { - return child === SyntaxKind.JsxClosingElement; - } - } - } - - function isIndentPreventedCoreComponent(child: SyntaxKind) { - switch (child) { - // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent - case SyntaxKind.OpenBraceToken: - case SyntaxKind.CloseBraceToken: - case SyntaxKind.OpenBracketToken: - case SyntaxKind.CloseBracketToken: - case SyntaxKind.OpenParenToken: - case SyntaxKind.CloseParenToken: - case SyntaxKind.ElseKeyword: - case SyntaxKind.WhileKeyword: - case SyntaxKind.AtToken: - case SyntaxKind.JsxClosingElement: - return true; - } - return false; - } - function getOpenTokenForList(node: Node, list: Node[]) { switch (node.kind) { case SyntaxKind.Constructor: