refactor(formatter,oxfmt): Use language as an identifier for format_embedded()#18323
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
format_embedded()
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the embedded code formatting interface to use language identifiers instead of tag names, improving separation of concerns between oxc_formatter and oxfmt. This prepares the codebase for future support of Angular templates and styles.
Changes:
- Renamed the
format_embedded()parameter fromtag_nametolanguageto reflect the abstraction change - Introduced language identifier mappings (e.g.,
csstag →"tagged-css"identifier, styled-jsx →"styled-jsx") - Updated
oxfmtto translate language identifiers to Prettier parser names, removing Prettier knowledge fromoxc_formatter
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/oxc_formatter/src/print/template.rs |
Maps template tag names to language identifiers and updates the format_embedded_template() function to use the new language parameter |
apps/oxfmt/src/core/external_formatter.rs |
Translates language identifiers to Prettier parser names and updates documentation to reflect the new abstraction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
11e215d to
8201b30
Compare
Merge activity
|
…embedded()` (#18323) Prepare for next PR, which supports `angular-(template|styles)` `oxc_formatter` should not know about Prettier; it should only inform `oxfmt` about what it finds.
8201b30 to
a88f2da
Compare

Prepare for next PR, which supports
angular-(template|styles)oxc_formattershould not know about Prettier; it should only informoxfmtabout what it finds.