fix(formatter): map embedded template ranges through source map ??????#9636
fix(formatter): map embedded template ranges through source map ??????#9636raashish1601 wants to merge 2 commits intobiomejs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 8332bf6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughRefactors embedded template-chunk range selection into a new helper Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
|
Can you explain why source maps were used? |
Fixes #9484
The formatter now maps embedded template chunk ranges back through the JavaScript source map before looking up parsed embedded snippets. This keeps TSX files with earlier parenthesized-JSX rewrites from shifting later embedded GraphQL ranges and tripping the printer's embedded-tag invariants.
Test Plan
issue_9484tocrates/biome_service/src/workspace/server.tests.rscargo test -p biome_service issue_9484 -- --nocapturecargo test -p biome_service format_js_with_embedded_graphql -- --nocapturecargo test -p biome_service issue_9131 -- --nocapturecargo fmt --allgit diff --checkDocs