mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Add fourslash tests & address CR comments
This commit is contained in:
@@ -396,10 +396,8 @@ namespace ts.formatting {
|
||||
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;
|
||||
const baseIndentSize = SmartIndenter.getBaseIndentation(options);
|
||||
return baseIndentSize > column ? baseIndentSize : column;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ts.formatting {
|
||||
// no indentation when the indent style is set to none,
|
||||
// so we can return fast
|
||||
if (options.IndentStyle === IndentStyle.None) {
|
||||
return getBaseIndentation(options);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const precedingToken = findPrecedingToken(position, sourceFile);
|
||||
@@ -27,7 +27,7 @@ namespace ts.formatting {
|
||||
// no indentation in string \regex\template literals
|
||||
const precedingTokenIsLiteral = isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind);
|
||||
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
|
||||
return getBaseIndentation(options);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
@@ -103,7 +103,7 @@ namespace ts.formatting {
|
||||
return getIndentationForNodeWorker(current, currentStart, /*ignoreActualIndentationRange*/ undefined, indentationDelta, sourceFile, options);
|
||||
}
|
||||
|
||||
function getBaseIndentation(options: EditorOptions) {
|
||||
export function getBaseIndentation(options: EditorOptions) {
|
||||
return options.BaseIndentSize || 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user