-
Notifications
You must be signed in to change notification settings - Fork 70
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
intellisense in tv config hangs on project when running process on large tv file #127
Comments
I'm experimenting with a new regex that is more performant and will update the docs after some more testing and usage. "tailwindCSS.experimental.classRegex": [
["tv\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", "\"(.*?)\""]
] |
old post:The issue is just the regex. There is no [
"tv\\((?<=\\()(?:[^()]*|\\([^)]*\\))+(?=\\))\\)",
"[\"'`]([^\"'`]*).*?[\"'`]"
] I didn't change the second regex that extracts the actual class names, because it doesn't ensure opening and closing string matching, but in normal case where you don't have syntax error in your code it will work, so good enough. Here example regex101: |
This comment was marked as off-topic.
This comment was marked as off-topic.
@bitabs If there were updates, they would be posted. Please don't post "are there any updates" type of comments. They are not helpful to maintainers. |
@binaryartifex @akomm Try the new pattern that was just merged: heroui-inc/tailwind-variants-docs#34 |
@ViktorPontinen this does seem a world of difference more performant, but now it registers everything as tailwind strings, which is frustrating when you define a literal and instead of getting suggested the literals, it suggests class names. I've also noticed some weird cases, such as object destructuring, it sometimes suggests class names when I'm trying to autocomplete the key of an object, though this is inconsistent and I can't for the life of me remember where this occurred in my codebase. Glad to know this is being looked at, hopefully some of this was found helpful. |
Same issue as @FFGFlash mentioned. Performance is back, but now most strings offer tailwind intellisense when it shouldn't. Attached is a screenshot example of the intellisense with expo-router for defining a Stack's presentation option. |
I'm in the same boat as you guys @FFGFlash @DavidAmyot unfortunately. A better regex pattern needs to found/figured and submitted. |
I'm currently driving with this one, see video below that it does not spam completion in wrong places: ["tv\\(\\{([^]+?)\\}\\)", "(?:\"([^\"]*?)\")|(?:'([^']*?)')|(?:`[^`]*?`)"] However in some places there is still utility class spam, but not because of the regex. Its a vscode tailwind plugin bug, as shown in the video: I think it thinks I don't have performance issues with this one. It looks long, but it is made so that it skips over invalid content quickly. |
I can't get it to work properly. With this one I get the inline color boxes atleast: "tv\\({[\\s\\S]*?slots:\\s*{[\\s\\S]*?['\"]([a-zA-Z0-9\\s:\\-\\/\\[\\]!]+)['\"]",
"tv\\({[\\s\\S]*?variants:\\s*{[\\s\\S]*?['\"]([a-zA-Z0-9\\s:\\-\\/\\[\\]!]+)['\"]" No hover or emmet though. This is my code: const button = tv({
slots: {
base: 'inline-flex items-center gap-2 transition-all rounded-full',
},
variants: {
color: {
primary: 'bg-orange-500 text-white hover:bg-orange-700 focus-visible:bg-orange-700 hover:-translate-y-1 focus-visible:-translate-y-1 hover:shadow-action-button focus-visible:shadow-action-button',
},
disabled: {
true: 'cursor-not-allowed bg-grey-50 text-grey-400'
},
size: {
small: '',
medium: '',
big: '',
},
},
defaultVariants: {
color: 'primary',
size: 'medium'
}
}) |
Describe the bug
When using a tailwind-variants
tv
config with a moderate amount of compound variations, the tailwind-intellisense extension hangs indefinitely for the whole project.To Reproduce
The best way i can think of to simulate the issue is the following
4a. Now add the following two compoundVariants to the above config. When i try to get intellisense working on any classNames momentarily, the loading tooltip appears and hangs indefinately. furthermore the entire intellisense process seems to hang indefinately on the whole project.
Expected behavior
Intellisense should continue to work without hanging - i thought at first this was an intellisense issue however having narrowed it down to the tv config i strongly suspect the way that typescript types are generated internally within tailwind-variants is possibly producing a huge amount of variations causing the workspace wide freeze.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: