Canonicalization: prevent inlining CSS-wide keywords - #20417
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "Update packages/tailwindcss/src/canonica..." | Re-trigger Greptile |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughCanonicalization now recognizes CSS-wide keyword values, including 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e115e3b1-6469-49db-9556-a777b9c0a646
📒 Files selected for processing (2)
packages/tailwindcss/src/canonicalize-candidates.test.tspackages/tailwindcss/src/canonicalize-candidates.ts
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This PR fixes an issue where canonicalization suggestions in intellisense result in 'weird' suggestions.
If we look at the CSS provided by the issue, this doesn't immediately make sense:
But it turns out that when you use Uniwind (React Native) with HeroUI, that the setup looks more like this:
During the canonicalization step, we inline all the
@themevalues, the reason for this is thattext-[#fff]can be turned intotext-whiteeven though they look slightly different:But when we inline them, it looks like this:
Internally, we use signatures to make sure that they are safe to be subtituted with eachother. In this case, the signatures will look like this:
If we now look at the signatures of the original issue, you would see:
That's because the
@themevariables were inlined, resulting in the exact same signature, thus we consider them the same.This PR makes sure to never inline CSS-wide keywords (such as
unset) and therefore keeping the CSS variable reference:Fixes: tailwindlabs/tailwindcss-intellisense#1610
Test plan
Checked manually in the regression repo
Before:

After:
