aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src/io/watcher.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_vfs/src/io/watcher.rs')
-rw-r--r--crates/ra_vfs/src/io/watcher.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_vfs/src/io/watcher.rs b/crates/ra_vfs/src/io/watcher.rs
index e33298477..5e9bc8ff3 100644
--- a/crates/ra_vfs/src/io/watcher.rs
+++ b/crates/ra_vfs/src/io/watcher.rs
@@ -1,4 +1,4 @@
1use crate::io; 1use crate::{io, RootFilter};
2use crossbeam_channel::Sender; 2use crossbeam_channel::Sender;
3use drop_bomb::DropBomb; 3use drop_bomb::DropBomb;
4use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher as NotifyWatcher}; 4use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher as NotifyWatcher};
@@ -8,7 +8,7 @@ use std::{
8 thread, 8 thread,
9 time::Duration, 9 time::Duration,
10}; 10};
11use walkdir::{DirEntry, WalkDir}; 11use walkdir::WalkDir;
12 12
13#[derive(Debug)] 13#[derive(Debug)]
14pub enum WatcherChange { 14pub enum WatcherChange {
@@ -83,13 +83,11 @@ impl Watcher {
83 }) 83 })
84 } 84 }
85 85
86 pub fn watch_recursive( 86 pub fn watch_recursive(&mut self, dir: &Path, filter: &RootFilter, emit_for_contents: bool) {
87 &mut self, 87 for res in WalkDir::new(dir)
88 dir: &Path, 88 .into_iter()
89 filter_entry: impl Fn(&DirEntry) -> bool, 89 .filter_entry(|entry| filter.can_contain(entry.path()).is_some())
90 emit_for_contents: bool, 90 {
91 ) {
92 for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) {
93 match res { 91 match res {
94 Ok(entry) => { 92 Ok(entry) => {
95 if entry.path().is_dir() { 93 if entry.path().is_dir() {