Fix crash in formatter on comment lookalikes in JSX closing tags - #64644
Mateusz Burzyński (Andarist) wants to merge 2 commits into
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
Adds regression coverage and scanner logic changes to prevent formatter crashes when JSX closing tags contain comment-lookalike sequences (e.g., </* */>), matching the linked TypeScript issue.
Changes:
- Add fourslash regression tests covering JSX closing-tag
/* */lookalikes and a couple of additional formatter edge cases. - Extend the formatting scanner with a new rescan action for JSX closing tags to avoid mis-tokenizing
</sequences.
| File | Description |
|---|---|
| tsc/internal/fourslash/tests/formatTypeArgumentStartingWithLessThan_test.go | New regression test for formatting with << type-argument edge case. |
| tsc/internal/fourslash/tests/formatNestedJSDocNullableType_test.go | New regression test for nested JSDoc nullable type formatting. |
| tsc/internal/fourslash/tests/formatJsxClosingTagFollowedByAsterisk_test.go | New regression test for </* */> in JSX fragments. |
| tsc/internal/fourslash/tests/formatJsxClosingTagFollowedByAsteriskAfterText_test.go | New regression test for </* */a> after text in JSX. |
| tsc/internal/fourslash/tests/formatJsxClosingTagFollowedByAsteriskAfterExpression_test.go | New regression test for </* */a> after an expression in JSX. |
| tsc/internal/format/scanner.go | Add a targeted rescan path for JSX closing tags to avoid interpreting /* as a comment. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.



fixes the issue reported here: #64622 (comment)