diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index ccc05d84426..ca94e143a62 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -128,10 +128,6 @@ namespace ts.formatting { if (actualIndentation !== Value.Unknown) { return actualIndentation; } - actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options); - if (actualIndentation !== Value.Unknown) { - return actualIndentation + options.indentSize!; // TODO: GH#18217 - } previous = current; current = current.parent; @@ -188,10 +184,6 @@ namespace ts.formatting { if (actualIndentation !== Value.Unknown) { return actualIndentation + indentationDelta; } - actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options); - if (actualIndentation !== Value.Unknown) { - return actualIndentation + indentationDelta; - } } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line @@ -388,49 +380,6 @@ namespace ts.formatting { return Value.Unknown; } - function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorSettings): number { - // actual indentation should not be used when: - // - node is close parenthesis - this is the end of the expression - if (node.kind === SyntaxKind.CloseParenToken) { - return Value.Unknown; - } - - if (node.parent && isCallOrNewExpression(node.parent) && node.parent.expression !== node) { - const fullCallOrNewExpression = node.parent.expression; - const startingExpression = getStartingExpression(fullCallOrNewExpression); - - if (fullCallOrNewExpression === startingExpression) { - return Value.Unknown; - } - - const fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end); - const startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end); - - if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) { - return Value.Unknown; - } - - return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options); - } - - return Value.Unknown; - - function getStartingExpression(node: Expression) { - while (true) { - switch (node.kind) { - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - case SyntaxKind.PropertyAccessExpression: - case SyntaxKind.ElementAccessExpression: - node = (node).expression; - break; - default: - return node; - } - } - } - } - function deriveActualIndentationFromList(list: ReadonlyArray, index: number, sourceFile: SourceFile, options: EditorSettings): number { Debug.assert(index >= 0 && index < list.length); const node = list[index];