aboutsummaryrefslogtreecommitdiff
path: root/crates/vfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/vfs/src')
-rw-r--r--crates/vfs/src/file_set.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs
index 956cffb29..3085fd818 100644
--- a/crates/vfs/src/file_set.rs
+++ b/crates/vfs/src/file_set.rs
@@ -30,33 +30,33 @@ impl FileSet {
30 self.paths[&file].file_name_and_extension() 30 self.paths[&file].file_name_and_extension()
31 } 31 }
32 32
33 pub fn list_files( 33 pub fn list_files_with_extensions(
34 &self, 34 &self,
35 anchor: FileId, 35 anchor: FileId,
36 anchor_relative_path: Option<&str>, 36 anchor_relative_path: Option<&str>,
37 ) -> Option<Vec<FileId>> { 37 ) -> Vec<(&str, Option<&str>)> {
38 let anchor_directory = { 38 let anchor_directory = {
39 let path = self.paths[&anchor].clone(); 39 let path = self.paths[&anchor].clone();
40 match anchor_relative_path { 40 match anchor_relative_path {
41 Some(anchor_relative_path) => path.join(anchor_relative_path), 41 Some(anchor_relative_path) => path.join(anchor_relative_path),
42 None => path.parent(), 42 None => path.parent(),
43 } 43 }
44 }?; 44 };
45 45
46 Some( 46 if let Some(anchor_directory) = anchor_directory {
47 self.paths 47 self.paths
48 .iter() 48 .iter()
49 .filter_map(|(&file_id, path)| { 49 .filter_map(|(_, path)| {
50 if path.parent()? == anchor_directory 50 if path.parent()? == anchor_directory {
51 && matches!(path.file_name_and_extension(), Some((_, Some("rs")))) 51 path.file_name_and_extension()
52 {
53 Some(file_id)
54 } else { 52 } else {
55 None 53 None
56 } 54 }
57 }) 55 })
58 .collect(), 56 .collect()
59 ) 57 } else {
58 Vec::new()
59 }
60 } 60 }
61 pub fn insert(&mut self, file_id: FileId, path: VfsPath) { 61 pub fn insert(&mut self, file_id: FileId, path: VfsPath) {
62 self.files.insert(path.clone(), file_id); 62 self.files.insert(path.clone(), file_id);