Following settings worked for me (inside .vscode/settings.json
, you can also put them at user level / system level settings in vscode instead of workspace level settings)
"files.watcherExclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/node_modules": true,
"**/some-soft-link-to-higher-level-directory-in-my-file-system" : true,
"**/.cache-loader" : true
}
.git, node_modules
are perhaps excluded by default, but depending on your workspace, you may need to add others. As an example, I had a soft link to a higher level directory in my file-system (which recursively had 100s of thousands of files). Similarly, .cache-loader
often has thousands of files.
Possibly useful note: it took me some time to realize that files.exclude
and files.watcherExclude
are two different settings.
Some theoretical opinion: Most answers here (and even in the official vscode documentation) suggest increasing the system watcher limits to a very large number. This works okay in most cases, however, it is like using a hammer in place of a screwdriver (is brute force, may not always work, and is not efficient). While the absolute system limit can (and perhaps should be) raised from the default limit, it is beneficial to optimize your workspace and avoid using unnecessary system resources.
/etc/sysctl.conf
and adding this line to the end of the file:fs.inotify.max_user_watches=524288
”, followed bysudo sysctl -p
. – grooveplex Jun 17 '18 at 23:07