diff options
Diffstat (limited to 'crates/vfs/src/file_set.rs')
-rw-r--r-- | crates/vfs/src/file_set.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index e9196fcd2..4aa2d6526 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs | |||
@@ -23,13 +23,22 @@ impl FileSet { | |||
23 | let mut base = self.paths[&anchor].clone(); | 23 | let mut base = self.paths[&anchor].clone(); |
24 | base.pop(); | 24 | base.pop(); |
25 | let path = base.join(path)?; | 25 | let path = base.join(path)?; |
26 | let res = self.files.get(&path).copied(); | 26 | self.files.get(&path).copied() |
27 | res | 27 | } |
28 | |||
29 | pub fn file_for_path(&self, path: &VfsPath) -> Option<&FileId> { | ||
30 | self.files.get(path) | ||
28 | } | 31 | } |
32 | |||
33 | pub fn path_for_file(&self, file: &FileId) -> Option<&VfsPath> { | ||
34 | self.paths.get(file) | ||
35 | } | ||
36 | |||
29 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { | 37 | pub fn insert(&mut self, file_id: FileId, path: VfsPath) { |
30 | self.files.insert(path.clone(), file_id); | 38 | self.files.insert(path.clone(), file_id); |
31 | self.paths.insert(file_id, path); | 39 | self.paths.insert(file_id, path); |
32 | } | 40 | } |
41 | |||
33 | pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ { | 42 | pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ { |
34 | self.paths.keys().copied() | 43 | self.paths.keys().copied() |
35 | } | 44 | } |