-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix crash showing completions in Intellisense when using a custom separator #13306
Conversation
@@ -1054,7 +1059,7 @@ function registerPlugins(plugins, context) { | |||
values: Object.keys(options.values ?? {}), | |||
hasDash: name !== '@', | |||
selectors({ modifier, value } = {}) { | |||
let candidate = '__TAILWIND_PLACEHOLDER__' | |||
let candidate = `TAILWINDPLACEHOLDER${id}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love the placeholder, but I didn't love it before either haha. One potential improvement could be to use a UUID (without the -
) but that's almost overkill for this.
crypto.randomUUID().replaceAll('-','')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I really don't like the placeholder either but it's necessary for the current implementation. UUID would definitely be overkill for this.
Intellisense uses the internal
getVariants
API and its use of__TAILWIND_PLACEHOLDER__
crashes inside Tailwind's variant formatting when the separator is_
. This crashes the entire completion routine in intellisense and prevents them from appearing.I've changed it to use no "special" characters to prevent the crash. Instead, we use
TAILWINDPLACEHOLDER
with a unique, random ID attached to eliminate potential conflicts with registered utilities.Fixes tailwindlabs/tailwindcss-intellisense#894