Replies: 12 comments 16 replies
-
The use case for us is explanatory comments that are parsed into the Storybook argsTable (in addition to dev usefulness) |
Beta Was this translation helpful? Give feedback.
-
going to try this one out for awhile: ["cva\\(([\\s\\S]*?)\\}[\\s]*?\\)", "[\"'`]([^\"'`]*).*?[\"'`]"] Basically, instead of matching characters excluding end parentheses ( |
Beta Was this translation helpful? Give feedback.
-
This seems to be working well so far. The only thing I could see being an improvement is if the regex could simply "exclude" anything in a comment (either lines starting with |
Beta Was this translation helpful? Give feedback.
-
I've found this to be an issue with generics as well when declaring variants. I've been using this regex with some success but could be improved:
and it works with a snippet like
|
Beta Was this translation helpful? Give feedback.
-
@arpadgabor |
Beta Was this translation helpful? Give feedback.
-
The tailwind regex is brittle. It breaks in a lot of strange scenarios with no clear reason. Is this a bug with vscode or tailwind? I can't see what would be wrong with the regex that causes these weird issues. Playing around with it more, definitely seems to be tied to the length or size of the object. |
Beta Was this translation helpful? Give feedback.
-
I think this is most definitely a tailwind or vscode bug. Here's what I've done as a temporary workaround for objects that are too large and break the regex intellisense: I wrap every class or list of classes in tw() which is defined as: It's kinda ugly, but I almost like it due to the fact it's a little more clear to whomever is reading the code that these are specifically tailwind classes. Example:
|
Beta Was this translation helpful? Give feedback.
-
This looks similar to an issue I'm seeing, where intellisense breaks when using |
Beta Was this translation helpful? Give feedback.
-
Linking @its-monotype's issue which feels related (#108) Describe the bug To Reproduce
|
Beta Was this translation helpful? Give feedback.
-
@joe-bell the PR I posted #99 resolves these parentheses issues. You can take the regex from there and it should solve most of the parentheses issues. Here are the regexes in case its helpful for someone else. Enables standalone cx as well as cva completion.
|
Beta Was this translation helpful? Give feedback.
-
My colleague is using this library and was having some trouble with Tailwind Intellisense as well. I've taken a stab at a less brittle regex, hopefully it's helpful to others: regexr.com/78lt3 My colleague is still having issues even after all of the regex tinkering but as far as we can tell, the regex isn't the primary issue. There may be something else going on with either VSCode or the Tailwind Intellisense plugin that makes it not work so well with longer CVA objects? |
Beta Was this translation helpful? Give feedback.
-
Any updates on this issue? It's clearly a Regex pattern problem. I cannot for the life of me to cleanly get autocomplete to work on cva components that have compound variants. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Using the regex provided in the readme for tailwind intellisense, the intellisense breaks if a comment inside the CVA object contains a parentheses.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Intellisense would not be impacted by content in comments.
Screenshots
Desktop (please complete the following information):
tailwind@3.2.4, cva@0.3.0
Beta Was this translation helpful? Give feedback.
All reactions