|
|
@ -1,5 +1,6 @@
|
|
|
|
use anyhow::{anyhow, bail, Context, Error};
|
|
|
|
use anyhow::{anyhow, bail, Context, Error};
|
|
|
|
use arc_swap::access::DynAccess;
|
|
|
|
use arc_swap::access::DynAccess;
|
|
|
|
|
|
|
|
use arc_swap::ArcSwap;
|
|
|
|
use futures_util::future::BoxFuture;
|
|
|
|
use futures_util::future::BoxFuture;
|
|
|
|
use futures_util::FutureExt;
|
|
|
|
use futures_util::FutureExt;
|
|
|
|
use helix_core::auto_pairs::AutoPairs;
|
|
|
|
use helix_core::auto_pairs::AutoPairs;
|
|
|
@ -158,6 +159,7 @@ pub struct Document {
|
|
|
|
language_server: Option<Arc<helix_lsp::Client>>,
|
|
|
|
language_server: Option<Arc<helix_lsp::Client>>,
|
|
|
|
|
|
|
|
|
|
|
|
diff_handle: Option<DiffHandle>,
|
|
|
|
diff_handle: Option<DiffHandle>,
|
|
|
|
|
|
|
|
version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
use std::{fmt, mem};
|
|
|
|
use std::{fmt, mem};
|
|
|
@ -404,6 +406,7 @@ impl Document {
|
|
|
|
language_server: None,
|
|
|
|
language_server: None,
|
|
|
|
diff_handle: None,
|
|
|
|
diff_handle: None,
|
|
|
|
config,
|
|
|
|
config,
|
|
|
|
|
|
|
|
version_control_head: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
|
|
|
|
pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
|
|
|
@ -707,6 +710,8 @@ impl Document {
|
|
|
|
None => self.diff_handle = None,
|
|
|
|
None => self.diff_handle = None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.version_control_head = provider_registry.get_current_head_name(&path);
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1158,6 +1163,17 @@ impl Document {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn version_control_head(&self) -> Option<Arc<Box<str>>> {
|
|
|
|
|
|
|
|
self.version_control_head.as_ref().map(|a| a.load_full())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn set_version_control_head(
|
|
|
|
|
|
|
|
&mut self,
|
|
|
|
|
|
|
|
version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
self.version_control_head = version_control_head;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
/// Tree-sitter AST tree
|
|
|
|
/// Tree-sitter AST tree
|
|
|
|
pub fn syntax(&self) -> Option<&Syntax> {
|
|
|
|
pub fn syntax(&self) -> Option<&Syntax> {
|
|
|
|