5

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

rioV8
  • 24,506
  • 3
  • 32
  • 49
zyxue
  • 7,904
  • 5
  • 48
  • 74
  • where do you see these commands logged? – rioV8 Dec 03 '20 at 14:41
  • 1
    @rioV8, in htop – zyxue Dec 03 '20 at 17:29
  • 1
    it is a [program written in rust](https://github.com/BurntSushi/ripgrep) that is an enhanced replacement for `grep`. Looking at your `rg` command it isn't searching for anything. is it only looking in `.go` files. Maybe ask via an VSC issue why they need to call it so often (on a MacOS) and what they are searching for – rioV8 Dec 03 '20 at 21:38

1 Answers1

3

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.

zyxue
  • 7,904
  • 5
  • 48
  • 74
  • then what is the reason to use `--no-ignore-parent` argument. the crux of `.gitignore` is that you locally specify what extra stuff you want to be ignored. – rioV8 Dec 04 '20 at 06:21
  • I don't know why `--no-ignore-parent` is used. I also find an alternative way is to exclude folders in vscode settings, which also seem to work. – zyxue Dec 04 '20 at 19:56