microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.16k stars 28.84k forks source link

Exclude gitignored files from file watcher #62725

Open thisismydesign opened 5 years ago

thisismydesign commented 5 years ago

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.

chrmarti commented 5 years ago

/findDuplicates

vscodebot[bot] commented 5 years ago

Potential duplicates:

thisismydesign commented 5 years ago

Also checked, couldn't find anything about this. Other gitignore related issues are mostly about search and explorer, but the idea is similar.

glzr-dev commented 5 years ago

+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.

guihkx commented 4 years ago

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. 🤷‍♂

drdozer commented 4 years ago

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.

rohanrajpal commented 4 years ago

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

goobta commented 4 years ago

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.

tailaiw commented 4 years ago

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

studgeek commented 4 years ago

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).

qacollective commented 4 years ago

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.

nrclark commented 4 years ago

+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.

admirabilis commented 3 years ago

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.

pwm commented 3 years ago

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

szcf-weiya commented 2 years ago

+1 for this feature

Zelnes commented 2 years ago

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

Shura-Joy commented 2 years ago

+1

abwilf commented 2 years ago

+1

grepgrok commented 2 years ago

+1

stefanpie commented 1 year ago

+1

jeffcarrico commented 1 year ago

+1

mshlis commented 1 year ago

+1 god please implement this feature already

michele-mormile commented 1 year ago

+1

XiangruLiu0 commented 1 year ago

+1

jlecordier commented 11 months ago

Hi everyone, while waiting for a PR, I've made an npm package to generate that :)

https://www.npmjs.com/package/watcher-exclude-gitignore

https://github.com/jlecordier/watcher-exclude-gitignore#readme

MoH-assan commented 8 months ago

+1

tvsfx commented 5 months ago

+1