[dotnet-watch] Do not watch content of directories that match file exclusions
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
Exclusion globs are listed in `EvaluationResult.ItemExclusions`. If it excludes an entire subdirectory, e.g. ends with `/**` , `/**/*.*` etc. we can avoid watching that subdirectory for changes. This will mitigate issues that occur when watching large directories recursively and receiving a lot of file system events.
Observations so far:
- Typical exclusions: `bin\Debug\**;obj\Debug\**;bin\**;obj\**;bin\Debug\net10.0\publish\**`
- We want to watch specific files in excluded directories, e.g. `obj\Debug\GlobalUsings.g.cs`.
- Currently we watch all directories that contain any evaluated items and their subdirectories.
- Instead, watch directories and files based on inclusion globs. Create non-recursive watchers for dirs containing explicitly listed files. Recursive watchers based on `**` glob patterns. If we have `**/*.cs` inclusion and `obj/Debug/**` exclusion and wanted to avoid recursive watcher for the entire project dir, we would need to create non-recursive watcher for project dir and whenever a new directory is added create a recursive watcher watching that dir (unless it contains excluded dir).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.