Skip to content

Commit 369253b

Browse files
committed
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
1 parent 218a5ba commit 369253b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/services/formatting/formatting.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ namespace ts.formatting {
394394
const startLinePosition = getLineStartPositionForPosition(startPos, sourceFile);
395395
const column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);
396396
if (startLine !== parentStartLine || startPos === column) {
397+
// Use the base indent size if it is greater than
398+
// the indentation of the inherited predecessor.
399+
if (options.BaseIndentSize > column) {
400+
return options.BaseIndentSize;
401+
}
397402
return column;
398403
}
399404
}

0 commit comments

Comments
 (0)