aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src/io/watcher.rs
diff options
context:
space:
mode:
authorBernardo <[email protected]>2019-01-22 17:38:34 +0000
committerAleksey Kladov <[email protected]>2019-01-26 08:46:27 +0000
commitbe14ab217ce29542a8b2c84282e822adcc69646c (patch)
tree99fd4d871d7b14eca6604cab9f6648584d23b6f0 /crates/ra_vfs/src/io/watcher.rs
parent0a086508524bed87bb15113437e9c2b1e1be4c42 (diff)
better test, avoid duplicated events
Diffstat (limited to 'crates/ra_vfs/src/io/watcher.rs')
-rw-r--r--crates/ra_vfs/src/io/watcher.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/ra_vfs/src/io/watcher.rs b/crates/ra_vfs/src/io/watcher.rs
index b370c5fbc..68bb6b692 100644
--- a/crates/ra_vfs/src/io/watcher.rs
+++ b/crates/ra_vfs/src/io/watcher.rs
@@ -100,16 +100,18 @@ impl Watcher {
100 log::warn!("could not watch \"{}\": {}", entry.path().display(), e) 100 log::warn!("could not watch \"{}\": {}", entry.path().display(), e)
101 } 101 }
102 } 102 }
103 } 103 } else {
104 if emit_for_contents && entry.depth() > 0 { 104 if emit_for_contents && entry.depth() > 0 {
105 // emit as create because we haven't seen it yet 105 // emit only for files otherwise we will cause watch_recursive to be called again with a dir that we are already watching
106 if let Err(e) = 106 // emit as create because we haven't seen it yet
107 self.sender 107 if let Err(e) =
108 .send(io::Task::HandleChange(WatcherChange::Create( 108 self.sender
109 entry.path().to_path_buf(), 109 .send(io::Task::HandleChange(WatcherChange::Create(
110 ))) 110 entry.path().to_path_buf(),
111 { 111 )))
112 log::warn!("watcher error: {}", e) 112 {
113 log::warn!("watcher error: {}", e)
114 }
113 } 115 }
114 } 116 }
115 } 117 }