-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
![Screen Shot 2023-07-18 at 10 53 57 AM](https://private-user-images.githubusercontent.com/5855893/254358125-94adef8d-a66b-41da-98ef-e64b3ed0a8ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5NjYwMTAsIm5iZiI6MTcyNTk2NTcxMCwicGF0aCI6Ii81ODU1ODkzLzI1NDM1ODEyNS05NGFkZWY4ZC1hNjZiLTQxZGEtOThlZi1lNjRiM2VkMGE4ZWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTBUMTA1NTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2IxNzE3NDcxZmRkZDVhMDI1ZmE0MzIyYjYwYjEwNjY5OGI1Y2VjZDZlYjNkMjJjMWM1ZTQ3MmVkYmU2ZmI1OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.H9JAl2mzoM89pAcUmE2ga6t9c6lXHWXZ0tcAFNvBgbc)
Add documentation on how to enable Tailwind IntelliSense inside
clsx
functionsFixes #64