tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.74k stars 181 forks source link

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

Open jdoss opened 1 week ago

jdoss commented 1 week ago

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 commented 1 week ago

Looks like Dev Container's had a similar issue that they fixed / worked around: https://github.com/microsoft/vscode-remote-release/issues/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 commented 1 week ago

Okay so a couple of questions:

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.