fix(formatter): should not set up tailwindcss callback when no tailwindcss configuration is set#17696
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. |
CodSpeed Performance ReportMerging #17696 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the formatter to only set up the Tailwind CSS callback when the experimentalTailwindcss configuration is explicitly provided, preventing unnecessary callback initialization when only embeddedLanguageFormatting is enabled.
Key changes:
- Modified
ExternalCallbacksAPI to acceptOption<Callback>instead of bareCallbacktypes - Moved callback creation logic to conditionally instantiate callbacks based on configuration
- Simplified the caller code to delegate configuration checks to the callback builder
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/oxc_formatter/src/external_formatter.rs |
Changed with_embedded_formatter and with_tailwind methods to accept Option<Callback> parameters |
apps/oxfmt/src/core/external_formatter.rs |
Added conditional logic to only create embedded and Tailwind callbacks when their respective configurations are enabled |
apps/oxfmt/src/core/format.rs |
Simplified caller code to use the updated to_external_callbacks signature and removed redundant configuration checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5044a86 to
56073c5
Compare
Merge activity
|
…ndcss configuration is set (#17696) Only set up the tailwindcss callback when the `experimentalTailwindcss` configuration is set. Previously, it would also set up when the `emebeddedLanguageFormatting` is `on`.
56073c5 to
dcfdd41
Compare
# Oxlint # Oxfmt ### 🚀 Features - a19cc93 oxfmt: Add debug logging to oxfmt LSP to troubleshoot resolved options at runtime (#17695) (Nicholas Rayburn) ### 🐛 Bug Fixes - 3b4aced formatter: Should not treat multi-type arguments of TSTypeReference as a complex type (#17708) (Dunqing) - dcfdd41 formatter: Should not set up tailwindcss callback when no tailwindcss configuration is set (#17696) (Dunqing) - 6f65901 formatter: Return original classes when there are no tailwindcss classes sort callback (#17689) (Dunqing) ### ⚡ Performance - c6a99fd formatter: Don't call `sort_tailwind_classes` if no classes need to be sorted (#17698) (Dunqing) Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>

Only set up the tailwindcss callback when the
experimentalTailwindcssconfiguration is set. Previously, it would also set up when theemebeddedLanguageFormattingison.