diff options
Diffstat (limited to 'src/tools/rust-analyzer/crates/vfs')
-rw-r--r-- | src/tools/rust-analyzer/crates/vfs/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/vfs/src/lib.rs b/src/tools/rust-analyzer/crates/vfs/src/lib.rs index fe3dfe619..06004adad 100644 --- a/src/tools/rust-analyzer/crates/vfs/src/lib.rs +++ b/src/tools/rust-analyzer/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 |