tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.82k stars 194 forks source link

tailwindcss-intellisense has an insatiable hunger for memory and cpu if you don't have tailwindcss installed yet #915

Closed matthewelmer closed 6 months ago

matthewelmer commented 7 months ago

What version of VS Code are you using?

v1.87.0

What version of Tailwind CSS IntelliSense are you using?

v0.10.5

What version of Tailwind CSS are you using?

Was not installed at time of issue.

What package manager are you using?

dnf

What operating system are you using?

fedora 39

Tailwind config

// n/a

VS Code settings

// it's 700 lines long...

Describe your issue

I was setting up a new computer and needed to edit some text files. I open VS Code to do so, enabling settings sync, only to have my fans go totally bonkers. Checking my system monitor revealed that this extension was the culprit. It's likely because I don't have tailwindcss installed yet. Perhaps we could check whether or not the user has an accessible tailwindcss installation before trying to summon Cthulhu in an attempt to find/use it?

Screencast from 2024-03-03 11-08-04.webm

matthewelmer commented 7 months ago

Oh! I almost forgot to mention... Thanks for this banger of an extension! Let me know if I can add anything to the bug report.

thecrypticace commented 6 months ago

This extension should basically do nothing if Tailwind CSS isn't installed. It looks to me like we booted the language server which means we detected a workspace that might have Tailwind installed. In the release version of the extension this should only happen when there's a tailwind config file or a CSS file with @config inside it.

Do you have a specific repo I can clone to look at?

Also, can you provide a list of all installed VSCode plugins and their versions? (you can run code --list-extensions --show-versions from the command line to get this list)

paulcoyle commented 6 months ago

For what it is worth, I am experiencing the same issue on macOS in the last week or so but I do have tailwindcss installed when this happens. The plugin process suddenly begins to take 100% of one core. For me this ends up blocking all intellisense until I kill the process. Here's what I have for plugins:

alexkrechik.cucumberautocomplete@2.15.2
bierner.markdown-mermaid@1.22.0
bradlc.vscode-tailwindcss@0.10.5
clinyong.vscode-css-modules@0.5.1
dbaeumer.vscode-eslint@2.4.4
denoland.vscode-deno@3.35.1
digitalbrainstem.javascript-ejs-support@1.3.3
dotjoshjohnson.xml@2.5.1
editorconfig.editorconfig@0.16.4
equinusocio.vsc-material-theme-icons@3.5.0
esbenp.prettier-vscode@10.1.0
github.copilot@1.172.0
github.copilot-chat@0.13.0
github.github-vscode-theme@6.3.4
github.vscode-github-actions@0.26.2
gruntfuggly.todo-tree@0.0.226
hoovercj.vscode-power-mode@3.0.2
humao.rest-client@0.25.1
iliazeus.vscode-ansi@1.1.7
jebbs.plantuml@2.17.5
jock.svg@1.5.3
marp-team.marp-vscode@2.8.0
mechatroner.rainbow-csv@3.11.0
mikestead.dotenv@1.0.1
ml.nc-gcode@0.13.0
ms-azuretools.vscode-docker@1.29.0
ms-vscode.live-server@0.4.13
ms-vscode.makefile-tools@0.8.22
ms-vscode.test-adapter-converter@0.1.9
ms-vscode.vscode-speech@0.6.0
ms-vsliveshare.vsliveshare@1.0.5918
msrvida.vscode-sanddance@4.1.0
oderwat.indent-rainbow@8.3.1
pomdtr.markdown-kroki@1.1.2
prisma.prisma@5.10.2
redhat.vscode-xml@0.26.1
redhat.vscode-yaml@1.14.0
robbowen.synthwave-vscode@0.1.15
stackbreak.comment-divider@0.4.0
stkb.rewrap@1.16.3
streetsidesoftware.code-spell-checker@3.0.1
streetsidesoftware.code-spell-checker-medical-terms@3.0.2
styled-components.vscode-styled-components@1.7.8
tamasfe.even-better-toml@0.19.2
tinaciousdesign.theme-tinaciousdesign@2.4.0
torn4dom4n.latex-support@3.10.0
tyriar.lorem-ipsum@1.3.1
unifiedjs.vscode-mdx@1.8.1
vitest.explorer@0.4.0
vscodevim.vim@1.27.2
yoavbls.pretty-ts-errors@0.5.3
yummygum.city-lights-icon-vsc@1.1.3
yummygum.city-lights-theme@1.1.9
matthewelmer commented 6 months ago

This extension should basically do nothing if Tailwind CSS isn't installed. It looks to me like we booted the language server which means we detected a workspace that might have Tailwind installed. In the release version of the extension this should only happen when there's a tailwind config file or a CSS file with @config inside it.

Do you have a specific repo I can clone to look at?

Also, can you provide a list of all installed VSCode plugins and their versions? (you can run code --list-extensions --show-versions from the command line to get this list)

Sorry, but the issue occurred in a very transient computing environment for me -- one that I'm not too interested in reproducing. I only filed this bug report as a heads-up, really. I do not care whether or not it's fixed.

It looks like @paulcoyle might be of more use here.

Sorry to not be much help! Thanks again for contributing.

thecrypticace commented 6 months ago

@paulcoyle Any chance you could you provide a project that reproduces this? Also, do you have a custom classRegex?

Something I'd suggest trying is switching to the pre-release version and seeing if your memory problems go away. There's been a good bit of refactoring and other updates — including stuff related to regexes causing possible runaway memory usage.

paulcoyle commented 6 months ago

@thecrypticace This fell off my radar but I just re-enabled and updated the plugin and, after a couple hours of use, I'm not seeing it eat up CPU any longer; it normally would have evidenced itself by now.

I was (and still am) using a custom classRegex that I picked up from the Tailwind Variants project:

["tv\\((([^()]*|\\([^()]*\\))*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]

I'm not sure I have time to come up with a reproduction right now. I am was only seeing it on this one project so it may take some to pare it down and remove anything I'm unable to share publicly. As far as I'm concerned I'd consider this "resolved" and, if I encounter it again, I'll put some time into reproducing it and file another issue. That cool?

thecrypticace commented 6 months ago

Yup, definitely. Thanks!