-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat: Add usage with Tailwind documentation #65
Conversation
Add documentation on how to enable Tailwind IntelliSense inside `clsx` functions Fixes lukeed#64
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.
Thanks! Can you move this section between Support
and Related
?
Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
@lukeed Done! |
Thanks :) |
```json | ||
{ | ||
"tailwindCSS.experimental.classRegex": [ | ||
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] |
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.
👋 @lukeed! Thanks for adding this regex! Can you please elaborate on your approach to building it? I was using https://github.com/shadcn/ui/blob/5e172fc34fdf015aa0d141f52cc8c082b8ae6613/.vscode/settings.json#L7-L8 before seeing your solution. There is a slight difference, so I'm curious if there are any edge cases not covered by any of the two regexps:
shadcn/ui
- ["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
+ ["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
your regex
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.
@edgarlr contributed this section so perhaps they can offer an explanation.
By eyeballing it, the difference is that ([^']*)
will match anything up to '
, which means that if "
or or backticks appear in the class value, then the regexp in our docs will include it as part of the value, whereas the other regexp stops there.
Looks like they're both not ideal, tbh
I don't use this extension, but perhaps something like this is better? I don't know if the extn is looking for the first matching group only, though
Add documentation on how to enable Tailwind IntelliSense inside
clsx
functionsFixes #64