aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_vfs/src')
-rw-r--r--crates/ra_vfs/src/io.rs4
-rw-r--r--crates/ra_vfs/src/lib.rs14
2 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_vfs/src/io.rs b/crates/ra_vfs/src/io.rs
index dc0b84d5a..3952b200b 100644
--- a/crates/ra_vfs/src/io.rs
+++ b/crates/ra_vfs/src/io.rs
@@ -169,7 +169,7 @@ fn convert_notify_event(event: DebouncedEvent, sender: &Sender<(PathBuf, ChangeK
169 // ignore 169 // ignore
170 } 170 }
171 DebouncedEvent::Rescan => { 171 DebouncedEvent::Rescan => {
172 // TODO rescan all roots 172 // TODO: rescan all roots
173 } 173 }
174 DebouncedEvent::Create(path) => { 174 DebouncedEvent::Create(path) => {
175 sender.send((path, ChangeKind::Create)).unwrap(); 175 sender.send((path, ChangeKind::Create)).unwrap();
@@ -185,7 +185,7 @@ fn convert_notify_event(event: DebouncedEvent, sender: &Sender<(PathBuf, ChangeK
185 sender.send((dst, ChangeKind::Create)).unwrap(); 185 sender.send((dst, ChangeKind::Create)).unwrap();
186 } 186 }
187 DebouncedEvent::Error(err, path) => { 187 DebouncedEvent::Error(err, path) => {
188 // TODO should we reload the file contents? 188 // TODO: should we reload the file contents?
189 log::warn!("watcher error \"{}\", {:?}", err, path); 189 log::warn!("watcher error \"{}\", {:?}", err, path);
190 } 190 }
191 } 191 }
diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs
index d589a254b..f07657db6 100644
--- a/crates/ra_vfs/src/lib.rs
+++ b/crates/ra_vfs/src/lib.rs
@@ -7,8 +7,10 @@
7//! 7//!
8//! It is also responsible for watching the disk for changes, and for merging 8//! It is also responsible for watching the disk for changes, and for merging
9//! editor state (modified, unsaved files) with disk state. 9//! editor state (modified, unsaved files) with disk state.
10//! TODO: Some LSP clients support watching the disk, so this crate should 10//!
11//! to support custom watcher events (related to https://github.com/rust-analyzer/rust-analyzer/issues/131) 11//! TODO: Some LSP clients support watching the disk, so this crate should to
12//! support custom watcher events (related to
13//! <https://github.com/rust-analyzer/rust-analyzer/issues/131>)
12//! 14//!
13//! VFS is based on a concept of roots: a set of directories on the file system 15//! VFS is based on a concept of roots: a set of directories on the file system
14//! which are watched for changes. Typically, there will be a root for each 16//! which are watched for changes. Typically, there will be a root for each
@@ -225,12 +227,12 @@ impl Vfs {
225 let mut cur_files = Vec::new(); 227 let mut cur_files = Vec::new();
226 // While we were scanning the root in the background, a file might have 228 // While we were scanning the root in the background, a file might have
227 // been open in the editor, so we need to account for that. 229 // been open in the editor, so we need to account for that.
228 let exising = self.root2files[root] 230 let existing = self.root2files[root]
229 .iter() 231 .iter()
230 .map(|&file| (self.files[file].path.clone(), file)) 232 .map(|&file| (self.files[file].path.clone(), file))
231 .collect::<FxHashMap<_, _>>(); 233 .collect::<FxHashMap<_, _>>();
232 for (path, text) in files { 234 for (path, text) in files {
233 if let Some(&file) = exising.get(&path) { 235 if let Some(&file) = existing.get(&path) {
234 let text = Arc::clone(&self.files[file].text); 236 let text = Arc::clone(&self.files[file].text);
235 cur_files.push((file, path, text)); 237 cur_files.push((file, path, text));
236 continue; 238 continue;
@@ -335,7 +337,7 @@ impl Vfs {
335 mem::replace(&mut self.pending_changes, Vec::new()) 337 mem::replace(&mut self.pending_changes, Vec::new())
336 } 338 }
337 339
338 /// Sutdown the VFS and terminate the background watching thread. 340 /// Shutdown the VFS and terminate the background watching thread.
339 pub fn shutdown(self) -> thread::Result<()> { 341 pub fn shutdown(self) -> thread::Result<()> {
340 self.worker.shutdown() 342 self.worker.shutdown()
341 } 343 }
@@ -360,7 +362,7 @@ impl Vfs {
360 } 362 }
361 363
362 fn remove_file(&mut self, file: VfsFile) { 364 fn remove_file(&mut self, file: VfsFile) {
363 //FIXME: use arena with removal 365 // FIXME: use arena with removal
364 self.files[file].text = Default::default(); 366 self.files[file].text = Default::default();
365 self.files[file].path = Default::default(); 367 self.files[file].path = Default::default();
366 let root = self.files[file].root; 368 let root = self.files[file].root;