Skip to content

Commit 9daa800

Browse files
author
Andy Hanson
committed
Respond to PR comments
1 parent 0a61334 commit 9daa800

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

src/compiler/scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace ts {
3131
scanJsxToken(): SyntaxKind;
3232
scanJSDocToken(): SyntaxKind;
3333
scan(): SyntaxKind;
34+
getText(): string;
3435
// Sets the text for the scanner to scan. An optional subrange starting point and length
3536
// can be provided to have the scanner only scan a portion of the text.
36-
getText(): string;
3737
setText(text: string, start?: number, length?: number): void;
3838
setOnError(onError: ErrorCallback): void;
3939
setScriptTarget(scriptTarget: ScriptTarget): void;

src/services/formatting/formattingScanner.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,22 +282,13 @@ namespace ts.formatting {
282282
}
283283

284284
function skipToEndOf(node: Node): void {
285-
scanner.setTextPos(backUpWhitespace());
285+
scanner.setTextPos(node.end);
286286
savedPos = scanner.getStartPos();
287287
lastScanAction = undefined;
288288
lastTokenInfo = undefined;
289289
wasNewLine = false;
290290
leadingTrivia = undefined;
291291
trailingTrivia = undefined;
292-
293-
function backUpWhitespace(): number {
294-
const text = scanner.getText();
295-
let end = node.end;
296-
while (end > 0 && isWhiteSpaceLike(text.charCodeAt(end - 1))) {
297-
end--;
298-
}
299-
return end;
300-
}
301292
}
302293
}
303294
}

0 commit comments

Comments
 (0)