pythongitvisual-studio-coderipgrep

Many rg commands started by vscode that consume 99% of CPUs


I'm working inside a very big github repo, say its structure is like

project-root
├── project-1
│   ├── subproject-a
│   └── subproject-others
└── project-2
    ├── subproject-b
    └── subproject-others

There are many projects, each contains many subprojects. I'm just working on one of the subprojects (e.g. subproject-a). When I opened vscode inside the subproject (it's a python subproject), I noticed that it launches many rg commands like below, and my CPU usage goes above 99%. I wonder what these rg commands are about? Are they just searching for stuffs inside the subproject, or the whole git repo, which contains tens of thousands of files? Why do they consume so many resources? How could I avoid that, please?

/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --files --hidden --case-sensitive -g **/*.go/** -g **/*.go -g !**/.git -g !**/.svn -g !**/.hg -g !**/CVS -g !**/.DS_Store -g !**/.classpath -g !**/.factorypath -g !**/.project -g !**/.settings -g !**/node_modules -g !**/bower_components -g !**/*.code-search --no-ignore-parent --follow --quiet --no-config --no-ignore-global


Solution

  • It turns out that there are four symlink folders with over 700k files in them. These folders are usually ignored in /project-root/.gitginore. So rg by default would ignore searching in them.

    But here because of --no-ignore-parent --follow flags, they are being searched nonetheless.

    I added these folders to /project-root/project-1/subproject-a/.gitignore again, and now these rg commands don't take so much cpu resource anymore.