aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_vfs/src/io.rs4
-rw-r--r--crates/ra_vfs/src/lib.rs8
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_vfs/src/io.rs b/crates/ra_vfs/src/io.rs
index ce3271d48..257f1bf53 100644
--- a/crates/ra_vfs/src/io.rs
+++ b/crates/ra_vfs/src/io.rs
@@ -19,7 +19,9 @@ pub enum FileEventKind {
19 Add(String), 19 Add(String),
20} 20}
21 21
22pub fn start() -> (Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, WorkerHandle) { 22pub(crate) type FsWorker = Worker<PathBuf, (PathBuf, Vec<FileEvent>)>;
23
24pub(crate) fn start() -> (FsWorker, WorkerHandle) {
23 thread_worker::spawn::<PathBuf, (PathBuf, Vec<FileEvent>), _>( 25 thread_worker::spawn::<PathBuf, (PathBuf, Vec<FileEvent>), _>(
24 "vfs", 26 "vfs",
25 128, 27 128,
diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs
index b80c12058..d4ba2cb45 100644
--- a/crates/ra_vfs/src/lib.rs
+++ b/crates/ra_vfs/src/lib.rs
@@ -27,10 +27,11 @@ use thread_worker::{WorkerHandle, Worker};
27 27
28use crate::{ 28use crate::{
29 arena::{ArenaId, Arena}, 29 arena::{ArenaId, Arena},
30 io::FileEvent, 30 io::{FileEvent, FsWorker},
31}; 31};
32 32
33/// `RootFilter` is a predicate that checks if a file can belong to a root 33/// `RootFilter` is a predicate that checks if a file can belong to a root. If
34/// several filters match a file (nested dirs), the most nested one wins.
34struct RootFilter { 35struct RootFilter {
35 root: PathBuf, 36 root: PathBuf,
36 file_filter: fn(&Path) -> bool, 37 file_filter: fn(&Path) -> bool,
@@ -86,7 +87,7 @@ struct Vfs {
86 roots: Arena<VfsRoot, RootFilter>, 87 roots: Arena<VfsRoot, RootFilter>,
87 files: Arena<VfsFile, VfsFileData>, 88 files: Arena<VfsFile, VfsFileData>,
88 // pending_changes: Vec<PendingChange>, 89 // pending_changes: Vec<PendingChange>,
89 worker: Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, 90 worker: FsWorker,
90 worker_handle: WorkerHandle, 91 worker_handle: WorkerHandle,
91} 92}
92 93
@@ -101,6 +102,7 @@ impl Vfs {
101 worker_handle, 102 worker_handle,
102 }; 103 };
103 104
105 // A hack to make nesting work.
104 roots.sort_by_key(|it| Reverse(it.as_os_str().len())); 106 roots.sort_by_key(|it| Reverse(it.as_os_str().len()));
105 107
106 for path in roots { 108 for path in roots {