Is there a way to make file watcher ignore certain files?

I have a sidecar container which is constantly monitoring the .git directory and creating/deleting lockfiles about once per second. This generates a lot of unecessary websocket traffic because of the notifyDidChangeFile event. Is there a way to configure the file watcher to ignore certain files (such as lockfiles)?

You can use the 'files.watcherExclude': { [globPattern: string]: boolean }; preference.

This will prevent the events from being sent by the backend to the frontend if it matches the patterns, but the system’s inotify handles will still be allocated. Work is being done to avoid this:

1 Like