Skip to content

Handle legacy key behavior in theme-driven suggestions for @utility #17733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Apr 21, 2025

Fixes tailwindlabs/tailwindcss-intellisense#1328

The alpha and beta releases used _ in theme keys to represent a .. This meant we used --leading-1_5 instead of --leading-1\.5 to add utilities like leading-1.5. We prefer the use of the escaped dot now but still want to make sure suggestions for the legacy key format still works as expected when surrounded by numbers.

This is the same as #16433 but for @utility since we apparently missed this when emitting suggestions for it

@thecrypticace thecrypticace marked this pull request as ready for review April 21, 2025 14:22
@thecrypticace thecrypticace requested a review from a team as a code owner April 21, 2025 14:22
@thecrypticace thecrypticace force-pushed the fix/utility-suggestions-with-underscore-digits branch from 559bc02 to e786443 Compare April 22, 2025 13:37
Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to make this behave the same as the default spacing utilities but I wonder when we can remove that special-casing for underscore separators like --spacing-1_5 😬

Do you think this (=the special handling for _) can eventually be moved into the IntelliSense extensions? 🤔

@thecrypticace
Copy link
Contributor Author

@philipp-spiess oh… hmmm. I don't know. The main problem I see with moving it into IntelliSense is that we really only want this behavior for theme keys.

If someone were to define a utility like this:

@utility foo-2_5 { color: red; }

IntelliSense wouldn't know enough to ignore the replacement for this one utility so it would get suggested as foo-2.5 which would not work.

@thecrypticace
Copy link
Contributor Author

It would be nice to remove this behavior though since it was really only for backwards compatibility with the alpha/beta releases. Maybe this is something we can discuss and figure out a timeline if/when we can remove it.

@thecrypticace thecrypticace merged commit 8bf06ab into main Apr 22, 2025
7 checks passed
@thecrypticace thecrypticace deleted the fix/utility-suggestions-with-underscore-digits branch April 22, 2025 14:02
@philipp-spiess
Copy link
Member

Yep totally makes sense. I wonder if in the future it would be helpful if a suggestion derrived from a theme key can also emit the used theme key variable somehow - could be fun for go-to-source or so or to find out when using a deprecated theme key 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4 intellisense suggests underscore instead of dot in custom utilities
2 participants