feat: Add usage with Tailwind documentation#65
Conversation
Add documentation on how to enable Tailwind IntelliSense inside `clsx` functions Fixes lukeed#64
lukeed
left a comment
There was a problem hiding this comment.
Thanks! Can you move this section between Support and Related?
Co-authored-by: Luke Edwards <[email protected]>
|
@lukeed Done! |
|
Thanks :) |
| ```json | ||
| { | ||
| "tailwindCSS.experimental.classRegex": [ | ||
| ["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] |
There was a problem hiding this comment.
👋 @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 regexThere was a problem hiding this comment.
@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
clsxfunctionsFixes #64