Fix formatting scanner on JSX text that looks like trivia (#39718)

* Fix formatting scanner on JSX text that looks like trivia

* Combine if statements

Co-authored-by: Andrew Branch <andrew@wheream.io>
This commit is contained in:
Orta Therox
2020-07-30 13:56:14 -04:00
committed by GitHub
parent bffe3540fa
commit faf128de15
4 changed files with 34 additions and 6 deletions

View File

@@ -483,7 +483,8 @@ namespace ts {
return node.pos;
}
if (isJSDocNode(node)) {
if (isJSDocNode(node) || node.kind === SyntaxKind.JsxText) {
// JsxText cannot actually contain comments, even though the scanner will think it sees comments
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
}