Allow glob patterns for native file watcher excludes
See original GitHub issueUpdate from bpasero
⚠️ VSCode SUPPORTS glob patterns as files.watcherExclude
. You can use any glob pattern and file events will be ignored properly. ⚠️
This issue is about supporting these glob patterns on the level of the file watcher library natively. The only reason we want this is to help Linux users with the “out of handles” error when many file handles are used for file watching.
⚠️ ignore this issue if you are not using Linux or when you are not seeing the “out of handles error” ⚠️
Original issue from ghuser
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.62.3
- OS Version: Ubuntu 18.04.6 LTS
(First of all a big acknowledgement on the great work done with watcher on linux!! It works great in most cases.)
One Issue: I have a multiroot workspace. One of the roots contains the following subdir ./node/node_modules
(instead of ./node_modules
). The existing exclusion pattern **/node_modules/*/**
does not exclude the nested node_modules
directory from being watched.
I have tried adding the following exclusion patterns:
**/*/node_modules/*/**
**/**/node_modules/*/**
*/**/node_modules/*/**
*/node_modules/*/**
but without luck.
What works though is: **/node/node_modules/*/**
, but this implies that we know the exact subdirectory path inside which the node_modules
directory will exist.
Steps to Reproduce:
- Make sure a multi-root workspace has been loaded to vscode before closing it. Also at least one of the root workspace directories should contain inside a
node/node_modules
directory. - execute:
strace -f -etrace=inotify_add_watch /path/to/code 2>&1 | grep node_modules
You will see paths containing node_modules
being printed. e.g.
[pid 4634] inotify_add_watch(58, "/projects/myproject/node/node_modules/modulename", IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_ONLYDIR|IN_DONT_FOLLOW|IN_EXCL_UNLINK) = 3024
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:12 (6 by maintainers)
Top GitHub Comments
I had to downgrade and pin VSCode to version 1.62 on my Ubuntu system to keep using the monorepo i’m working with daily. I also had to turn this setting on to keep using the older filewatcher.
@jaypea If possible use the command described on top to find out whether you have missed some exclusion pattern and also be able to provide some detailed feedback to the team with specific examples on when a directory is not excluded.
For example the specific command helped me fix my problem because I found out that I had to also add
**/node/node_modules/*/**
in the exclusion list.What is described on this issue is that it would be even better to be able to exclude a directory (e.g
node_modules
) anywhere in the path without the need to specify the relative path to it.