Port TS#61534: correct source location when react-jsx and whitespace before jsx#2807
Merged
jakebailey merged 3 commits intomainfrom Feb 17, 2026
Merged
Conversation
… whitespace before jsx Skip leading trivia when computing the location range for JSX elements, self-closing elements, and fragments in the JSX transformer. This ensures correct columnNumber values in react-jsxdev source location metadata. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port correct source location for react-jsx handling
Port TS#61534: correct source location when react-jsx and whitespace before jsx
Feb 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request ports TypeScript PR #61534 to fix incorrect JSX source location metadata (specifically columnNumber in react-jsxdev output) that occurred when whitespace preceded JSX elements. The fix ensures that column numbers now point to the actual start of the JSX tag rather than including leading whitespace.
Changes:
- Modified JSX transformation to skip leading trivia when computing source locations for
react-jsxdevmode - Updated all affected test baselines to match TypeScript's correct output
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/transformers/jsxtransforms/jsx.go | Added trivia skipping logic to visitJsxElement, visitJsxSelfClosingElement, and visitJsxFragment functions to compute correct source positions |
| testdata/baselines/reference/submodule/conformance/*.diff | Reduced diff files showing convergence with TypeScript reference output |
| testdata/baselines/reference/submodule/conformance/*.js | Updated baselines with corrected column numbers matching TypeScript |
| testdata/baselines/reference/submodule/compiler/*.diff | Reduced diff files showing convergence with TypeScript reference output |
| testdata/baselines/reference/submodule/compiler/*.js | Updated baselines with corrected column numbers matching TypeScript |
DanielRosenwasser
approved these changes
Feb 17, 2026
Copilot AI
added a commit
that referenced
this pull request
Feb 25, 2026
…before jsx (#2807) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSX source location metadata (
columnNumberinreact-jsxdevoutput) was computed fromnode.Pos(), which includes leading trivia (whitespace). This produced incorrect column numbers when whitespace preceded JSX elements.Ports microsoft/TypeScript#61534.
scanner.SkipTrivia()before using the position as the location invisitJsxElement,visitJsxSelfClosingElement, andvisitJsxFragmentBaseline diffs confirm column numbers now match TypeScript output across all affected
react-jsxdevtest cases.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.