Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/vfs/src/lib.rs')
-rw-r--r--crates/vfs/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs
index fe3dfe6196..06004adad3 100644
--- a/crates/vfs/src/lib.rs
+++ b/crates/vfs/src/lib.rs
@@ -184,6 +184,11 @@ impl Vfs {
mem::take(&mut self.changes)
}
+ /// Provides a panic-less way to verify file_id validity.
+ pub fn exists(&self, file_id: FileId) -> bool {
+ self.get(file_id).is_some()
+ }
+
/// Returns the id associated with `path`
///
/// - If `path` does not exists in the `Vfs`, allocate a new id for it, associated with a