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.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index e52dbe0f..fb89e2e0 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -204,14 +204,11 @@ pub struct Document {
pub readonly: bool,
- pub previous_diagnostic_id: Option<String>,
-
/// Annotations for LSP document color swatches
pub color_swatches: Option<DocumentColorSwatches>,
// NOTE: ideally this would live on the handler for color swatches. This is blocked on a
// large refactor that would make `&mut Editor` available on the `DocumentDidChange` event.
pub color_swatch_controller: TaskController,
- pub pull_diagnostic_controller: TaskController,
// NOTE: this field should eventually go away - we should use the Editor's syn_loader instead
// of storing a copy on every doc. Then we can remove the surrounding `Arc` and use the
@@ -731,8 +728,6 @@ impl Document {
color_swatches: None,
color_swatch_controller: TaskController::new(),
syn_loader,
- previous_diagnostic_id: None,
- pull_diagnostic_controller: TaskController::new(),
}
}
@@ -980,12 +975,11 @@ impl Document {
};
let identifier = self.path().map(|_| self.identifier());
- let language_servers: Vec<_> = self.language_servers.values().cloned().collect();
+ let language_servers = self.language_servers.clone();
// mark changes up to now as saved
let current_rev = self.get_current_revision();
let doc_id = self.id();
- let atomic_save = self.config.load().atomic_save;
let encoding_with_bom_info = (self.encoding, self.has_bom);
let last_saved_time = self.last_saved_time;
@@ -1035,7 +1029,7 @@ impl Document {
// Assume it is a hardlink to prevent data loss if the metadata cant be read (e.g. on certain Windows configurations)
let is_hardlink = helix_stdx::faccess::hardlink_count(&write_path).unwrap_or(2) > 1;
- let backup = if path.exists() && atomic_save {
+ let backup = if path.exists() {
let path_ = write_path.clone();
// hacks: we use tempfile to handle the complex task of creating
// non clobbered temporary path for us we don't want
@@ -1124,7 +1118,7 @@ impl Document {
text: text.clone(),
};
- for language_server in language_servers {
+ for (_, language_server) in language_servers {
if !language_server.is_initialized() {
continue;
}
@@ -1178,7 +1172,7 @@ impl Document {
}
}
- pub fn detect_editor_config(&mut self) {
+ pub(crate) fn detect_editor_config(&mut self) {
if self.config.load().editor_config {
if let Some(path) = self.path.as_ref() {
self.editor_config = EditorConfig::find(path);
@@ -1660,7 +1654,7 @@ impl Document {
let savepoint_idx = self
.savepoints
.iter()
- .position(|savepoint_ref| std::ptr::eq(savepoint_ref.as_ptr(), savepoint))
+ .position(|savepoint_ref| savepoint_ref.as_ptr() == savepoint as *const _)
.expect("Savepoint must belong to this document");
let savepoint_ref = self.savepoints.remove(savepoint_idx);
@@ -1815,12 +1809,6 @@ impl Document {
self.version
}
- pub fn word_completion_enabled(&self) -> bool {
- self.language_config()
- .and_then(|lang_config| lang_config.word_completion.and_then(|c| c.enable))
- .unwrap_or_else(|| self.config.load().word_completion.enable)
- }
-
pub fn path_completion_enabled(&self) -> bool {
self.language_config()
.and_then(|lang_config| lang_config.path_completion)
@@ -2289,10 +2277,6 @@ impl Document {
pub fn reset_all_inlay_hints(&mut self) {
self.inlay_hints = Default::default();
}
-
- pub fn has_language_server_with_feature(&self, feature: LanguageServerFeature) -> bool {
- self.language_servers_with_feature(feature).next().is_some()
- }
}
#[derive(Debug, Default)]