Respond to PR comments

This commit is contained in:
Andy Hanson 2016-06-30 06:46:49 -07:00
parent 0a61334677
commit 9daa800c6a
2 changed files with 2 additions and 11 deletions

View File

@ -31,9 +31,9 @@ namespace ts {
scanJsxToken(): SyntaxKind;
scanJSDocToken(): SyntaxKind;
scan(): SyntaxKind;
getText(): string;
// Sets the text for the scanner to scan. An optional subrange starting point and length
// can be provided to have the scanner only scan a portion of the text.
getText(): string;
setText(text: string, start?: number, length?: number): void;
setOnError(onError: ErrorCallback): void;
setScriptTarget(scriptTarget: ScriptTarget): void;

View File

@ -282,22 +282,13 @@ namespace ts.formatting {
}
function skipToEndOf(node: Node): void {
scanner.setTextPos(backUpWhitespace());
scanner.setTextPos(node.end);
savedPos = scanner.getStartPos();
lastScanAction = undefined;
lastTokenInfo = undefined;
wasNewLine = false;
leadingTrivia = undefined;
trailingTrivia = undefined;
function backUpWhitespace(): number {
const text = scanner.getText();
let end = node.end;
while (end > 0 && isWhiteSpaceLike(text.charCodeAt(end - 1))) {
end--;
}
return end;
}
}
}
}