mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Fix Format Selection on JSDoc comments (#42411)
This commit is contained in:
@@ -390,7 +390,8 @@ namespace ts.formatting {
|
||||
sourceFile));
|
||||
}
|
||||
|
||||
function formatSpanWorker(originalRange: TextRange,
|
||||
function formatSpanWorker(
|
||||
originalRange: TextRange,
|
||||
enclosingNode: Node,
|
||||
initialIndentation: number,
|
||||
delta: number,
|
||||
@@ -424,16 +425,20 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
if (!formattingScanner.isOnToken()) {
|
||||
const indentation = SmartIndenter.nodeWillIndentChild(options, enclosingNode, /*child*/ undefined, sourceFile, /*indentByDefault*/ false)
|
||||
? initialIndentation + options.indentSize!
|
||||
: initialIndentation;
|
||||
const leadingTrivia = formattingScanner.getCurrentLeadingTrivia();
|
||||
if (leadingTrivia) {
|
||||
indentTriviaItems(leadingTrivia, initialIndentation, /*indentNextTokenOrTrivia*/ false,
|
||||
indentTriviaItems(leadingTrivia, indentation, /*indentNextTokenOrTrivia*/ false,
|
||||
item => processRange(item, sourceFile.getLineAndCharacterOfPosition(item.pos), enclosingNode, enclosingNode, /*dynamicIndentation*/ undefined!));
|
||||
if (options.trimTrailingWhitespace !== false) {
|
||||
trimTrailingWhitespacesForRemainingRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.trimTrailingWhitespace !== false) {
|
||||
trimTrailingWhitespacesForRemainingRange();
|
||||
}
|
||||
|
||||
return edits;
|
||||
|
||||
// local functions
|
||||
|
||||
Reference in New Issue
Block a user