remove isIndentPreventedChildNode

This commit is contained in:
SaschaNaz
2015-08-26 01:06:37 +09:00
parent 56fc7ec68d
commit 92e3b3b5fa
+2 -27
View File
@@ -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: