diff options
Diffstat (limited to 'crates/ra_vfs')
-rw-r--r-- | crates/ra_vfs/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs index 6b4eb6842..3805be570 100644 --- a/crates/ra_vfs/src/lib.rs +++ b/crates/ra_vfs/src/lib.rs | |||
@@ -94,6 +94,7 @@ impl Roots { | |||
94 | let mut roots = Arena::default(); | 94 | let mut roots = Arena::default(); |
95 | // A hack to make nesting work. | 95 | // A hack to make nesting work. |
96 | paths.sort_by_key(|it| Reverse(it.as_os_str().len())); | 96 | paths.sort_by_key(|it| Reverse(it.as_os_str().len())); |
97 | paths.dedup(); | ||
97 | for (i, path) in paths.iter().enumerate() { | 98 | for (i, path) in paths.iter().enumerate() { |
98 | let nested_roots = paths[..i] | 99 | let nested_roots = paths[..i] |
99 | .iter() | 100 | .iter() |
@@ -181,6 +182,10 @@ impl Vfs { | |||
181 | None | 182 | None |
182 | } | 183 | } |
183 | 184 | ||
185 | pub fn num_roots(&self) -> usize { | ||
186 | self.roots.len() | ||
187 | } | ||
188 | |||
184 | pub fn load(&mut self, path: &Path) -> Option<VfsFile> { | 189 | pub fn load(&mut self, path: &Path) -> Option<VfsFile> { |
185 | if let Some((root, rel_path, file)) = self.find_root(path) { | 190 | if let Some((root, rel_path, file)) = self.find_root(path) { |
186 | return if let Some(file) = file { | 191 | return if let Some(file) = file { |