-
Notifications
You must be signed in to change notification settings - Fork 217
JavaScript heap out of memory when using tailwindCSS.experimental.classRegex #893
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
Comments
Some additional information from my machine that might help. Version: 1.85.1 (user setup)
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:49:37.021Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045 |
Just following up with some notes from tinkering around with the regex container, I believe the issue lies with the amount of data captured with the container regex When I change the capture group to something much smaller, and general (it's basically matching any, and every string in the file now) the extension is working as expected, and not timing out anymore. This change results in container capture groups of 200-400 characters. Here's what I changed it to. {
"tailwindCSS.experimental.classRegex": [
["([\"'`][^\"'`]*.*?[\"'`])", "[\"'`]([^\"'`]*).*?[\"'`]"]
]
} |
Ideally, having the ability to specify I experimented with the |
I had the same issue. I was surprised considering its a Macbook pro 16" M3 Max with 64GB memory 🤦🏻 |
Ha, not surprised tbh. There's a lot of code that gets executed with the container match regex.
|
The problem is with Here, a very simplified, non-escaped form: I have a fix for this but I'm not yet sure if it's the right fix. I need to do some more testing today. |
Turns out my fix wasn't that good so I ended up rewriting things, discovered new JS APIs in the process, and rewrote things some more. I have a little bit more testing to do but I think things are in a better spot for this now. Should have at least a fix in the pre-release version of the extension tomorrow. |
Was hoping to get a pre-release out today but I've run into something odd — I think it's a v8 bug but I'm not 100% sure yet. |
I just merged #897 which fixes this. It'll be available in the pre-release version of the extension. If you could give it a test and report back to me that would be 💯 |
I'm using pre-release version but I'm suffering from the same issue. |
@dgknca can you open a separate issue with a reproduction that I can take a look at? |
I was using this regex https://www.tailwind-variants.org/docs/getting-started#intellisense-setup-optional
replaced it with:
works fine now. |
What version of VS Code are you using?
Version:
1.85.1 (user setup)
What version of Tailwind CSS IntelliSense are you using?
v0.10.4
also triedv0.11.36
What version of Tailwind CSS are you using?
^3.3.6
What package manager are you using?
yarn berry v3.7.0
What operating system are you using?
Windows 10
Tailwind config
VS Code settings
Reproduction URL
https://github.com/mfb-davidmay/tw-intellisense-timeout/blob/main/src/components/Button/index.tsx
Describe your issue
When attempting to load Intellisense for the aforementioned file, Visual Studio will consume large amounts of memory and CPU to the point that the Tailwind Extension runs out of memory.
I've pinpointed the issue to be an experimental regex that I've added which was recommended by the author of the
tailwind-variants
library. The regex shown here is my attempt to improve the one suggested to simplify the matching.I believe the memory exception might be because there's too many classes matched within the container? but unsure as the logging of the extension isn't telling me much.
Removing the classRegex returns the extension back to normal, and I can use it with standard out of the box support. Just wanting some help to understand what I can do to enable support for the
tv(...)
functions in my components.Here's the extension output.
The text was updated successfully, but these errors were encountered: