vscode: Exclude gitignored files from file watcher

I would like an option to disable watching of gitgnored files (i.e. add them to the files.watcherExclude option automatically).

I think this makes sense, at least I couldn’t think of a use case for watching gitignored files. It might also help with autorefresh related issues and could make the files.watcherExclude option thinner.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 77
  • Comments: 27 (1 by maintainers)

Most upvoted comments

+1 for this feature. I’ve had to add many lines to files.watcherExclude to get rid of the “unable to watch for file changes in this large workspace” warning. It is a large workspace (around 20 separate Git repos), but 90% of the things I specify in files.watcherExclude could be automatically read in from the various .gitignore files. Maybe I’ll make a fork tonight and try to figure out what it would take to implement this.

If added it would nice it worked the same as “search.useIgnoreFiles”, looking at both .gitignore and .ignore so that some gitignore entries can be overriden (e.g. sub-repos).

This repeatedly hurts me. I tend to have a small number of source files, but quite large folders in my .gitignore. Those can have tens of thousands of files. Please, please, please add a default or toggle to black-list everything in the gitignore globs from the watcher process.

+1 for this feature

+1 I’m surprised this is not easily configurable.

I honestly thought that would have been the default, that’s why I didn’t notice the incredibly high CPU usage from watcherService before, since I have other processes that I need using a lot of CPU too.

+1 on this.

I work with a large build that produces hundreds of thousands of files along the way. I have a nice .gitignore for my project. I wish that Vscode could just detect it and respect it.

+1 to this. What are included in .gitignore 99% match what should be excluded by the watcher. This feature would be very convenient.

Another +1 on this one. This also plays in the whole idea of “maintaining only source code on git” and for most repositories, the .gitignore will already contain all of the files that shouldn’t be watched anyways.

+1 to this feature, would really help in excluding the same folders twice.

+1 god please implement this feature already

+1 Of course this is needed. No one has looked into this for more than 2 years ?

Yet another +1 to for this feature request. I have a small repo which generates hundreds of thousands of files … this is common in data science when data is being acquired from external points of truth but need to be stored (and IGNORED!) locally.

+1

+1

I just discovered VSCode wasn’t doing this by default the worst way possible…

A bunch of tabs in Chromium were crashing (I was getting that “Oh snap!” message), other programs becoming unresponsive… So I opened the system monitor and noticed the CPU usage of VSCode was really high, and the memory usage was peaking at 5-6 GB (I have 8 GB).

That was happening because I’m building a Flatpak program, and I’m using flatpak-builder to do so:

$ flatpak-builder build-dir/ org.flatpak.Hello.json

Unfortunately (for me), flatpak-builder creates two symbolic links pointing to /run: The first one inside build-dir/ and the other one inside .flatpak-build/. I didn’t think much of it because I had those two directories in my .gitignore

But because File Watcher doesn’t read paths from .gitignore, it was basically trying to map the entire filesystem, plus my external hard drives. 🤷‍♂