aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-12 14:08:20 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-12 14:08:20 +0000
commit74ecfc2729d2d0771304a4fed3afdfa2c2d99b43 (patch)
treeeacf6870c6fab537d787bc2764901028ce595f0a /crates/ra_vfs/src
parenta36e310229f13d6959d6ce95c99b659700cefc9a (diff)
parent4fd361343449bcdf7af4642851dc5dbf772f1a68 (diff)
Merge #804
804: Fix some typos r=killercup a=killercup Cherry-picked and updated from my now-closed PR. All credit goes to [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker). Co-authored-by: Pascal Hertleif <[email protected]>
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 5d98d905c..3dd05197e 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
@@ -212,12 +214,12 @@ impl Vfs {
212 let mut cur_files = Vec::new(); 214 let mut cur_files = Vec::new();
213 // While we were scanning the root in the background, a file might have 215 // While we were scanning the root in the background, a file might have
214 // been open in the editor, so we need to account for that. 216 // been open in the editor, so we need to account for that.
215 let exising = self.root2files[root] 217 let existing = self.root2files[root]
216 .iter() 218 .iter()
217 .map(|&file| (self.files[file].path.clone(), file)) 219 .map(|&file| (self.files[file].path.clone(), file))
218 .collect::<FxHashMap<_, _>>(); 220 .collect::<FxHashMap<_, _>>();
219 for (path, text) in files { 221 for (path, text) in files {
220 if let Some(&file) = exising.get(&path) { 222 if let Some(&file) = existing.get(&path) {
221 let text = Arc::clone(&self.files[file].text); 223 let text = Arc::clone(&self.files[file].text);
222 cur_files.push((file, path, text)); 224 cur_files.push((file, path, text));
223 continue; 225 continue;
@@ -322,7 +324,7 @@ impl Vfs {
322 mem::replace(&mut self.pending_changes, Vec::new()) 324 mem::replace(&mut self.pending_changes, Vec::new())
323 } 325 }
324 326
325 /// Sutdown the VFS and terminate the background watching thread. 327 /// Shutdown the VFS and terminate the background watching thread.
326 pub fn shutdown(self) -> thread::Result<()> { 328 pub fn shutdown(self) -> thread::Result<()> {
327 self.worker.shutdown() 329 self.worker.shutdown()
328 } 330 }
@@ -347,7 +349,7 @@ impl Vfs {
347 } 349 }
348 350
349 fn remove_file(&mut self, file: VfsFile) { 351 fn remove_file(&mut self, file: VfsFile) {
350 //FIXME: use arena with removal 352 // FIXME: use arena with removal
351 self.files[file].text = Default::default(); 353 self.files[file].text = Default::default();
352 self.files[file].path = Default::default(); 354 self.files[file].path = Default::default();
353 let root = self.files[file].root; 355 let root = self.files[file].root;