From 31e256f23f640581659659a218611b866694ee2f Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 30 Oct 2014 15:35:28 -0700 Subject: [PATCH] indent argument lists if they are on different line with parent --- src/services/formatting/format.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/formatting/format.ts b/src/services/formatting/format.ts index e5e255e4d82..14b86a4f1dc 100644 --- a/src/services/formatting/format.ts +++ b/src/services/formatting/format.ts @@ -281,7 +281,13 @@ module ts.formatting { var tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.kind === listStartToken) { // make sure that this token does not belong to the child - doConsumeTokenAndAdvanceScanner(tokenInfo, node, nodeIndentation); + var startTokenIndentation = nodeIndentation; + var tokenStartLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + if (node.parent.kind !== SyntaxKind.SourceFile && tokenStartLine !== nodeStartLine) { + var indentation = nodeIndentation.getIndentation() + options.IndentSize; + startTokenIndentation = getDynamicIndentation(node, indentation, indentation, nodeIndentation); + } + doConsumeTokenAndAdvanceScanner(tokenInfo, node, startTokenIndentation); } } } @@ -301,6 +307,7 @@ module ts.formatting { } } } + } );