aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 87eb34ba..dd40421f 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -13,6 +13,7 @@ use crate::{DocumentId, ViewId};
use std::collections::HashMap;
+#[cfg_attr(feature = "debug", derive(Debug))]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum Mode {
Normal,
@@ -52,6 +53,31 @@ pub struct Document {
language_server: Option<Arc<helix_lsp::Client>>,
}
+#[cfg(feature = "debug")]
+use std::fmt;
+#[cfg(feature = "debug")]
+impl fmt::Debug for Document {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Document")
+ .field("id", &self.id)
+ .field("text", &self.text)
+ .field("selections", &self.selections)
+ .field("path", &self.path)
+ .field("mode", &self.mode)
+ .field("restore_cursor", &self.restore_cursor)
+ .field("syntax", &self.syntax)
+ .field("language", &self.language)
+ .field("changes", &self.changes)
+ .field("old_state", &self.old_state)
+ // .field("history", &self.history)
+ .field("last_saved_revision", &self.last_saved_revision)
+ .field("version", &self.version)
+ .field("diagnostics", &self.diagnostics)
+ // .field("language_server", &self.language_server)
+ .finish_non_exhaustive()
+ }
+}
+
/// Like std::mem::replace() except it allows the replacement value to be mapped from the
/// original value.
fn take_with<T, F>(mut_ref: &mut T, closure: F)