Skip to content

Allow glob patterns for native file watcher excludes #137872

Closed

Description

Update 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:

  1. 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.
  2. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityfile-watcherFile watcherinsiders-releasedPatch has been released in VS Code Insiderson-testplanupstreamIssue identified as 'upstream' component related (exists outside of VS Code)upstream-issue-linkedThis is an upstream issue that has been reported upstream

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions