@@ -1,6 +1,6 @@
11use anyhow::Error;
22use std::future::Future;
3−use std::path::PathBuf;
3+use std::path::{Path, PathBuf};
44
55use helix_core::{
66 syntax::LOADER, ChangeSet, Diagnostic, History, Position, Range, Rope, RopeSlice, Selection,
@@ -201,6 +201,13 @@ impl Document {
201201 &self.state.selection
202202 }
203203
204+ pub fn relative_path(&self) -> Option<&Path> {
205+ self.path.as_ref().map(|path| {
206+ path.strip_prefix(std::env::current_dir().unwrap())
207+ .unwrap_or(path)
208+ })
209+ }
210+
204211 // pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {
205212 // self.state.doc.slice
206213 // }