From 369253bbc419db2db106c2250382a25fb2046115 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Tue, 21 Jun 2016 11:46:49 -0700 Subject: [PATCH] Fix case when a document contains multiple script blocks with different base indentations. Use the base indent size if it is greater that the indentation of the inherited predecessor --- src/services/formatting/formatting.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index ef8fddcfb3a..50295de3e1a 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -394,6 +394,11 @@ namespace ts.formatting { const startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); const column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { + // Use the base indent size if it is greater than + // the indentation of the inherited predecessor. + if (options.BaseIndentSize > column) { + return options.BaseIndentSize; + } return column; } }