aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs
diff options
context:
space:
mode:
authorBernardo <[email protected]>2019-01-21 17:37:46 +0000
committerAleksey Kladov <[email protected]>2019-01-26 08:46:27 +0000
commit7f7c4e7465f58cdbfdaaf232d571960f1b754b7c (patch)
treec45ced6a30832a53e2485744751ddd810663107c /crates/ra_vfs
parentf88355ccb5e8ea2381e13eabcdb64880e757aff1 (diff)
do not emit create for directory again
Diffstat (limited to 'crates/ra_vfs')
-rw-r--r--crates/ra_vfs/src/io.rs7
-rw-r--r--crates/ra_vfs/src/watcher.rs4
-rw-r--r--crates/ra_vfs/tests/vfs.rs3
3 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_vfs/src/io.rs b/crates/ra_vfs/src/io.rs
index 25acec9b1..a74222c02 100644
--- a/crates/ra_vfs/src/io.rs
+++ b/crates/ra_vfs/src/io.rs
@@ -68,11 +68,11 @@ impl Worker {
68 let watcher_clone = watcher.clone(); 68 let watcher_clone = watcher.clone();
69 let (worker, worker_handle) = 69 let (worker, worker_handle) =
70 thread_worker::spawn("vfs", 128, move |input_receiver, output_sender| { 70 thread_worker::spawn("vfs", 128, move |input_receiver, output_sender| {
71 let res = input_receiver 71 input_receiver
72 .into_iter() 72 .into_iter()
73 .map(|t| handle_task(t, &watcher_clone)) 73 .map(|t| handle_task(t, &watcher_clone))
74 .try_for_each(|it| output_sender.send(it)); 74 .try_for_each(|it| output_sender.send(it))
75 res.unwrap() 75 .unwrap()
76 }); 76 });
77 match Watcher::start(worker.inp.clone()) { 77 match Watcher::start(worker.inp.clone()) {
78 Ok(w) => { 78 Ok(w) => {
@@ -99,6 +99,7 @@ impl Worker {
99 if let Some(watcher) = self.watcher.lock().take() { 99 if let Some(watcher) = self.watcher.lock().take() {
100 let _ = watcher.shutdown(); 100 let _ = watcher.shutdown();
101 } 101 }
102 let _ = self.worker.shutdown();
102 self.worker_handle.shutdown() 103 self.worker_handle.shutdown()
103 } 104 }
104} 105}
diff --git a/crates/ra_vfs/src/watcher.rs b/crates/ra_vfs/src/watcher.rs
index d8c35f2a3..606935891 100644
--- a/crates/ra_vfs/src/watcher.rs
+++ b/crates/ra_vfs/src/watcher.rs
@@ -87,7 +87,7 @@ impl Watcher {
87 &mut self, 87 &mut self,
88 dir: &Path, 88 dir: &Path,
89 filter_entry: impl Fn(&DirEntry) -> bool, 89 filter_entry: impl Fn(&DirEntry) -> bool,
90 emit_for_existing: bool, 90 emit_for_contents: bool,
91 ) { 91 ) {
92 for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) { 92 for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) {
93 match res { 93 match res {
@@ -98,7 +98,7 @@ impl Watcher {
98 Err(e) => log::warn!("could not watch \"{}\": {}", dir.display(), e), 98 Err(e) => log::warn!("could not watch \"{}\": {}", dir.display(), e),
99 } 99 }
100 } 100 }
101 if emit_for_existing { 101 if emit_for_contents && entry.depth() > 0 {
102 // emit as create because we haven't seen it yet 102 // emit as create because we haven't seen it yet
103 if let Err(e) = 103 if let Err(e) =
104 self.sender 104 self.sender
diff --git a/crates/ra_vfs/tests/vfs.rs b/crates/ra_vfs/tests/vfs.rs
index 71b25a5c9..b18ea74a3 100644
--- a/crates/ra_vfs/tests/vfs.rs
+++ b/crates/ra_vfs/tests/vfs.rs
@@ -40,9 +40,6 @@ fn test_vfs_works() -> std::io::Result<()> {
40 fs::write(file_path, text)? 40 fs::write(file_path, text)?
41 } 41 }
42 42
43 let gitignore = dir.path().join("a/.gitignore");
44 fs::write(gitignore, "/target").unwrap();
45
46 let a_root = dir.path().join("a"); 43 let a_root = dir.path().join("a");
47 let b_root = dir.path().join("a/b"); 44 let b_root = dir.path().join("a/b");
48 45