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
This commit is contained in:
Jason Ramsay 2016-06-21 11:46:49 -07:00
parent 218a5ba0bb
commit 369253bbc4

View file

@ -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;
}
}