Skip to content

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

Merged
orta merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/38799
Jul 30, 2020
Merged

Fix formatting scanner on JSX text that looks like trivia#39718
orta merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/38799

Conversation

@orta
Copy link
Copy Markdown
Contributor

@orta orta commented Jul 23, 2020

Fixes #38799

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 23, 2020
Comment thread src/compiler/utilities.ts Outdated
Debug.assert(tokenInfo.token.end === child.end, "Token end is child end");
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved down to ensures that the scanner always moves forward

if (tokenInfo.token.end > childStartPos) {
if (tokenInfo.token.pos > childStartPos) {
formattingScanner.skipToStartOf(child);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the outer token's start position is ahead of the childs start, then we're basically in a weird state - try reparsing

@orta orta requested a review from weswigham July 23, 2020 19:32
@orta orta merged commit faf128d into microsoft:master Jul 30, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSX Format: Debug Failure. False expression: Token end is child end

4 participants