Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index fb89e2e0..e7d83ab0 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -1936,8 +1936,11 @@ impl Document {
Url::from_file_path(self.path()?).ok()
}
- pub fn uri(&self) -> Option<helix_core::Uri> {
- Some(self.path()?.clone().into())
+ pub fn uri(&self) -> helix_core::Uri {
+ self.path
+ .clone()
+ .map(|path| path.into())
+ .unwrap_or(helix_core::Uri::Scratch(self.id))
}
#[inline]