3

My VScode is behaving strangely. When I checkout or pull with many changes in files, it creates many processes called rg that drain the CPU to 100% usage. This problem persists even if I kill the VScode, I have to manually kill the processes.

I found some old threads about disabling symlinks with "search.followSymlinks": false but it didn't help. Might it be some indexing problem?

I have noticed that initializing js/ts language features is spinning but never completes and the whole UI lags. Happy to provide more details like extensions, etc.

I couldn't find a thread with the same problem around 2021/22 so sorry if duplicated.

enter image description here

Xorii
  • 63
  • 7
  • `rg` is [ripgrep](https://github.com/BurntSushi/ripgrep) – starball Feb 01 '23 at 18:03
  • @user is it somehow preinstalled? I tried its commands but `command not found` – Xorii Feb 02 '23 at 08:41
  • Yes, it's bundled internally with the VS Code installation because VS Code uses it. In my installation (Ubuntu snap), it's under /snap/code/###/usr/share/code/resources/app/node_modules.asar.unpacked/@vscode/ripgrep/bin/rg – starball Feb 02 '23 at 08:59
  • Also possibly related: [Many rg commands started by vscode that consume 99% of CPUs](/q/65120743) – starball Feb 03 '23 at 21:11
  • Thanks for that. I tried to install the rg manually and it seems it helped so far. – Xorii Feb 07 '23 at 08:04
  • Interesting... In what way has it helped? – starball Feb 07 '23 at 08:06
  • Checkout/pull/anything that triggers the indexing with bigger changes is not consuming the CPU and is not making vscode unusable. But maybe in the future, it will start again ¯\_(ツ)_/¯. Previously it took some time to get to this state – Xorii Feb 07 '23 at 12:18
  • Does this answer your question? [Many rg commands started by vscode that consume 99% of CPUs](https://stackoverflow.com/questions/65120743/many-rg-commands-started-by-vscode-that-consume-99-of-cpus) – starball Mar 29 '23 at 03:18

1 Answers1

1

This can happen when a lot of new files are created in a directory in your workspace that is being watched for changes by VSCode, or more likely, an extension, e.g. when you build/pull/download/unzip into a directory in your workspace.

Try add the directory/ies where many files are being created to the VSCode setting files.watcherExclude (search for that in VSCode settings).

I found I had to include a glob that matched the relative path of the directory (i.e. relative to the top level Workspace folder), rather than the absolute path. E.g. If the top level folder that I added to my workspace was called TopStuff and the directory where a lot of files were being created was TopStuff/build/ adding **/TopStuff/build/** didn't work, but adding **/build/** did.

JobJob
  • 3,822
  • 3
  • 33
  • 34