Open
Description
Apparently we add watchers for both the included directory, and nested package.
[newFile][path: /home/test/AndroidManifest.xml]
[_notifyWatchers]
/home/test/AndroidManifest.xml isWithin /home
/home/test/AndroidManifest.xml isWithin /home/test
This is a simple example that demonstrates that PhysicalResourceProvider
behaves the same as our MemoryResourceProvider
.
import 'package:analyzer/file_system/physical_file_system.dart';
main() {
PhysicalResourceProvider.INSTANCE
.getFolder('/Users/scheglov/tmp/20231203')
.watch()
.changes
.listen((event) {
print('[root][event: $event]');
});
PhysicalResourceProvider.INSTANCE
.getFolder('/Users/scheglov/tmp/20231203/test')
.watch()
.changes
.listen((event) {
print('[test][event: $event]');
});
}
When I create a.dart
file, both watches are notified.
[root][event: add /Users/scheglov/tmp/20231203/test/a.dart]
[test][event: add /Users/scheglov/tmp/20231203/test/a.dart]
@DanTup do you know if this is an expected behavior, or accidental?
I think this does not affect significantly analysis of Dart files, we add changed files to the list, but if it was not yet (or ever be) read as FileState
, we quickly exit from collectAffected()
.