Skip to content
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

tailwindcss-intellisense spawns ripgrep process that chews CPU on a project without Tailwindcss #986

Open
jdoss opened this issue Jun 24, 2024 · 5 comments
Labels
question Further information is requested

Comments

@jdoss
Copy link

jdoss commented Jun 24, 2024

What version of VS Code are you using?

$ code --version
1.90.2
5437499feb04f7a586f677b155b039bc2b3669eb
x64

What version of Tailwind CSS IntelliSense are you using?

v0.10.5

What version of Tailwind CSS are you using?

No tailwind in my current project.

What package manager are you using?

n/a

What operating system are you using?

Fedora Linux 40 with /home as a BTRFS subvolume on a local NVMe drive.

Tailwind config

N/A

VS Code settings

{
    "python.defaultInterpreterPath": "/bin/python",
    "workbench.startupEditor": "none",
    "application.shellEnvironmentResolutionTimeout": 30,
    "editor.minimap.enabled": false,
    "workbench.colorTheme": "Monokai Pro (Filter Machine)",
    "workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
    "editor.mouseWheelZoom": true,
    "files.trimTrailingWhitespace": true,
    "editor.renderWhitespace": "all",
    "[python]": {
        "editor.detectIndentation" : false,
        "editor.insertSpaces": true,
        "editor.tabSize": 4,
        "editor.formatOnType": true,
        "editor.codeActionsOnSave": {
            "source.fixAll": "explicit",
            "source.organizeImports": "explicit"
        },
        "editor.defaultFormatter": "ms-python.black-formatter"
    },
    "editor.multiCursorModifier": "ctrlCmd",
    "redhat.telemetry.enabled": false,
    "editor.fontSize": 20,
    "editor.tabSize": 2,
    "files.insertFinalNewline": true,
    "cSpell.ignoreWords": [
        "vofhoa"
    ],
    "files.associations": {
        "*.nomad": "hcl",
        "*.toml": "toml",
        "*.ign": "json",
        "*.jinja": "jinja",
        "*.j2": "jinja-yaml",
        "*.bu": "jinja-yaml"
    },
    "vs-kubernetes": {
        "vs-kubernetes.minikube-show-information-expiration": "2024-01-16T23:50:49.632Z",
        "vs-kubernetes.crd-code-completion": "disabled"
    },
    "editor.acceptSuggestionOnEnter": "on",
    "editor.quickSuggestionsDelay": 50,
    "editor.find.autoFindInSelection": "never",
    "editor.autoIndent": "full",
    "window.closeWhenEmpty": true,
    "editor.emptySelectionClipboard": true,
    "files.encoding": "utf8",
    "editor.detectIndentation": true,
    "editor.dragAndDrop": true,
    "go.toolsManagement.autoUpdate": true,
    "editor.codeActionsOnSave": {},
    "[hcl]": {},
    "emeraldwalk.runonsave": {
        "commands": [
            {
                "match": "\\.nomad",
                "cmd": "nomad fmt ${file}"
            }
        ]
    },
    "python.terminal.activateEnvInCurrentTerminal": true,
    "python.analysis.fixAll": [],
    "terminal.integrated.sendKeybindingsToShell": true,
    "[jinja-html]": {},
    "editor.rulers": [
        119
    ],
    "yaml.schemas": {
        "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
    },
    "yaml.customTags": [
        "!ENV scalar",
        "!ENV sequence",
        "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
        "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
        "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
    ],
    "editor.defaultFormatter": "ms-python.black-formatter",
    "inference.model": "custom",
    "editor.formatOnSave": true,
    "git.openRepositoryInParentFolders": "never",
    "mypy.targets": [
        "app"
    ],
    "docker.dockerPath": "podman",
    "docker.environment": {
        "DOCKER_HOST": "unix:///run/user/1000/podman/podman.sock"
    },
    "settingsSync.ignoredSettings": [
        "-docker.environment",
        "-docker.dockerPath"
    ],
    "docker.networks.groupBy": "NetworkName",
    "notebook.defaultFormatter": "ms-python.black-formatter",
    "python.REPL.sendToNativeREPL": true,
    "explorer.fileNesting.patterns": {
        "*.ts": "${capture}.js",
        "*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
        "*.jsx": "${capture}.js",
        "*.tsx": "${capture}.ts",
        "tsconfig.json": "tsconfig.*.json",
        "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb",
        "*.sqlite": "${capture}.${extname}-*",
        "*.db": "${capture}.${extname}-*",
        "*.sqlite3": "${capture}.${extname}-*",
        "*.db3": "${capture}.${extname}-*",
        "*.sdb": "${capture}.${extname}-*",
        "*.s3db": "${capture}.${extname}-*"
    }
}

Describe your issue

If I enable the tailwindcss-intellisense extension and launch VS Code in a project directory that does not have any TailwindCSS code (AFAIK) the extension spawns a rg process that uses 1000%+ CPU.

jdoss@sw-0608:~/Documents/projects$ ps aux |grep tailwind
jdoss     561108  0.3  0.0 1186094516 84208 ?    Sl   11:03   0:00 /usr/share/code/code /home/jdoss/.vscode/extensions/bradlc.vscode-tailwindcss-0.11.77/dist/tailwindServer.js --node-ipc --clientProcessId=476605
jdoss     561169  0.3  0.0 1186094516 83532 ?    Sl   11:03   0:00 /usr/share/code/code /home/jdoss/.vscode/extensions/bradlc.vscode-tailwindcss-0.11.76/dist/tailwindServer.js --node-ipc --clientProcessId=458090
jdoss     561201  0.5  0.0 1186094516 85776 ?    Sl   11:03   0:00 /usr/share/code/code /home/jdoss/.vscode/extensions/bradlc.vscode-tailwindcss-0.11.75/dist/tailwindServer.js --node-ipc --clientProcessId=178375
jdoss     563488 1190  0.0  95584 12800 ?        Sl   11:04   2:26 /usr/share/code/resources/app/node_modules.asar.unpacked/@vscode/ripgrep/bin/rg --files --hidden --case-sensitive --no-require-git -g **/{tailwind,tailwind.config,tailwind.*.config,tailwind.config.*}.{js,cjs,ts,mjs} -g !**/.git -g !**/.svn -g !**/.hg -g !**/CVS -g !**/.DS_Store -g !**/Thumbs.db -g !/{**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store,**/Thumbs.db,**/.git/**,**/node_modules/**,**/.hg/**,**/.svn/**} --no-ignore --follow --no-config --no-ignore-global

jdoss@sw-0608:~$ cd /proc/563488/cwd/
jdoss@sw-0608:.../563488/cwd$ ls -lah
total 12K
drwxrwxr-x. 1 jdoss jdoss  122 Jun 18 13:05 .
drwxr-xr-x. 1 jdoss jdoss 2.0K Mar  8 12:40 ..
drwxr-xr-x. 1 jdoss jdoss  258 May 29 17:01 apps
drwxr-xr-x. 1 jdoss jdoss  278 Jun 18 13:00 data
drwxr-xr-x. 1 jdoss jdoss  144 Jun 18 13:03 .git
-rw-r--r--. 1 jdoss jdoss   15 Jun 18 13:00 .gitignore
-rw-r--r--. 1 jdoss jdoss 1.1K May  3 15:14 LICENSE
-rw-r--r--. 1 jdoss jdoss    0 May  3 15:22 README.md
drwxr-xr-x. 1 jdoss jdoss   38 May  3 16:32 scripts
-rwxr-xr-x. 1 jdoss jdoss  324 May  8 16:42 selfhost
drwxr-xr-x. 1 jdoss jdoss    0 May  3 16:14 template

This project is an private one that I use to manage container apps on my workstation. It has a data directory that container applications like home assistant, paperless, gitea etc use as volume mounts.

jdoss@sw-0608:~/.../projects/data$ ls -lah
total 4.0K
drwxr-xr-x. 1 jdoss jdoss 278 Jun 18 13:00 .
drwxrwxr-x. 1 jdoss jdoss 122 Jun 18 13:05 ..
drwxr-xr-x. 1 jdoss jdoss  44 May  6 10:08 coredns
drwxr-xr-x. 1 jdoss jdoss  18 May 10 16:17 echoserver
drwxr-xr-x. 1 jdoss jdoss  44 May  6 10:22 gitea
-rw-r--r--. 1 jdoss jdoss  14 Jun 18 13:00 .gitignore
drwxr-xr-x. 1 jdoss jdoss  72 May  6 16:06 homeassistant
drwxr-xr-x. 1 jdoss jdoss  50 May  6 16:44 jellyfin
drwxr-xr-x. 1 jdoss jdoss 184 May  8 12:02 lame
drwxr-xr-x. 1 jdoss jdoss  34 May  7 12:27 n8n
drwxr-xr-x. 1 jdoss jdoss 146 May  7 15:18 paperless
drwxr-xr-x. 1 jdoss jdoss  46 May  6 15:07 stepca
drwxr-xr-x. 1 jdoss jdoss  90 May  9 15:20 temporal
drwxr-xr-x. 1 jdoss jdoss 248 Jun 21 16:38 traefik
drwxr-xr-x. 1 jdoss jdoss  26 May  8 00:14 vaultwarden
drwxr-xr-x. 1 jdoss jdoss  80 May  8 02:15 windmill

Some of these projects do have .ts and .js files in this directory so maybe it is choking on watching all of those files? Maybe the extension should check for a tailwind config and only spawn the rg process if it knows that TailwindCSS is being used in the project root?

@thecrypticace
Copy link
Contributor

Looks like Dev Container's had a similar issue that they fixed / worked around: microsoft/vscode-remote-release#9738

It's not open source (that I can see) so I don't know exactly what they did to fix it but one of the comments gave me potential ideas to go on. I'll see what I can come up with.

Thanks for reporting this!

@thecrypticace
Copy link
Contributor

Okay so a couple of questions:

  • Are you using PNPM for any of those projects?
  • If you take that manual rg command from ps and run it yourself in the same working directory without the --follow flag does it complete quickly?
  • Do you know what kind of mounts you are using in Docker? Are they actual volume mounts, bindfs, or something else?
  • What storage driver are the mounts using?

You're on an NVMe SSD so I doubt drive speed is not even remotely in play here. I wonder if Docker is doing something weird with those directories that causes directory listing and/or other file operations to slow down.

@thecrypticace thecrypticace added the question Further information is requested label Jun 24, 2024
@robcresswell
Copy link

I think I've found something similar in my project. It's a Python data project that as part of normal operation will install tens or hundreds of node projects. There's no tailwind install or config in the project root though, is there a sensible way I can disable it? I have the plugin installed for other projects I work on 😃

@Ev357
Copy link

Ev357 commented Aug 29, 2024

i think i have a similar problem. I noticed when my laptop suddenly started crashing. When i looked into my processes:
image
I'm using v0.0.24 with neovim (btw).
image
I just opened a index.vue file in an empty folder.

@zaaack
Copy link

zaaack commented Sep 4, 2024

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants