|
|
@ -191,6 +191,8 @@ pub struct Document {
|
|
|
|
pub focused_at: std::time::Instant,
|
|
|
|
pub focused_at: std::time::Instant,
|
|
|
|
|
|
|
|
|
|
|
|
pub readonly: bool,
|
|
|
|
pub readonly: bool,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub repo_root_dir: Arc<PathBuf>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Inlay hints for a single `(Document, View)` combo.
|
|
|
|
/// Inlay hints for a single `(Document, View)` combo.
|
|
|
@ -683,6 +685,7 @@ impl Document {
|
|
|
|
focused_at: std::time::Instant::now(),
|
|
|
|
focused_at: std::time::Instant::now(),
|
|
|
|
readonly: false,
|
|
|
|
readonly: false,
|
|
|
|
jump_labels: HashMap::new(),
|
|
|
|
jump_labels: HashMap::new(),
|
|
|
|
|
|
|
|
repo_root_dir: Arc::new(PathBuf::from("/")),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -700,6 +703,7 @@ impl Document {
|
|
|
|
encoding: Option<&'static Encoding>,
|
|
|
|
encoding: Option<&'static Encoding>,
|
|
|
|
config_loader: Option<Arc<ArcSwap<syntax::Loader>>>,
|
|
|
|
config_loader: Option<Arc<ArcSwap<syntax::Loader>>>,
|
|
|
|
config: Arc<dyn DynAccess<Config>>,
|
|
|
|
config: Arc<dyn DynAccess<Config>>,
|
|
|
|
|
|
|
|
provider_registry: &DiffProviderRegistry,
|
|
|
|
) -> Result<Self, DocumentOpenError> {
|
|
|
|
) -> Result<Self, DocumentOpenError> {
|
|
|
|
// If the path is not a regular file (e.g.: /dev/random) it should not be opened.
|
|
|
|
// If the path is not a regular file (e.g.: /dev/random) it should not be opened.
|
|
|
|
if path
|
|
|
|
if path
|
|
|
@ -729,6 +733,8 @@ impl Document {
|
|
|
|
|
|
|
|
|
|
|
|
doc.detect_indent_and_line_ending();
|
|
|
|
doc.detect_indent_and_line_ending();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc.repo_root_dir = provider_registry.get_repo_root(path);
|
|
|
|
|
|
|
|
|
|
|
|
Ok(doc)
|
|
|
|
Ok(doc)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|