mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
unindent dangling closing token
This commit is contained in:
@@ -496,10 +496,19 @@ namespace ts.formatting {
|
||||
case SyntaxKind.WhileKeyword:
|
||||
case SyntaxKind.AtToken:
|
||||
return indentation;
|
||||
default:
|
||||
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
|
||||
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
|
||||
case SyntaxKind.SlashToken:
|
||||
case SyntaxKind.GreaterThanToken: {
|
||||
if (container.kind === SyntaxKind.JsxOpeningElement ||
|
||||
container.kind === SyntaxKind.JsxClosingElement ||
|
||||
container.kind === SyntaxKind.JsxSelfClosingElement
|
||||
) {
|
||||
return indentation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
|
||||
return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation;
|
||||
},
|
||||
getIndentation: () => indentation,
|
||||
getDelta: child => getEffectiveDelta(delta, child),
|
||||
|
||||
Reference in New Issue
Block a user