Ensure resolved hint's file exists

This commit is contained in:
Kirill Bulatov 2023-08-29 14:19:17 +03:00
parent 10464c7c42
commit caf018507a
3 changed files with 11 additions and 0 deletions

View file

@ -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