question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow glob patterns for native file watcher excludes

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jaypeacommented, Mar 27, 2022

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.

"files.legacyWatcher": "on"
0reactions
ghusercommented, Mar 30, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the glob pattern in Node.js
The glob pattern adds all files within a directory with the .java ... of what a glob is, let's learn how to implement...
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. Hosted on GitHub.
Read more >
glob exclude pattern - python
You can't exclude patterns with the glob function, globs only allow for inclusion patterns. Globbing syntax is very limited (even a [!.
Read more >
Configuring Vitest
Files to exclude from the test run, using glob pattern. ... Externalize means that Vite will bypass the package to native Node.
Read more >
Packaging
Patterns allows you to define globs that will be excluded / included from the resulting artifact. If you wish to exclude files you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found