aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorIvan Tham2021-06-07 14:34:19 +0000
committerBlaž Hrastnik2021-06-10 13:00:08 +0000
commit7cc13fefe9bd09ea778a0eb8c26bf133e6ad2476 (patch)
tree764c662e47f12134a8a7f20211573243100777a5 /helix-view
parent1a3a92463405fdd4738fbdbfda212aef58a2919d (diff)
Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/Cargo.toml1
-rw-r--r--helix-view/src/document.rs7
-rw-r--r--helix-view/src/editor.rs5
-rw-r--r--helix-view/src/tree.rs13
-rw-r--r--helix-view/src/view.rs4
5 files changed, 12 insertions, 18 deletions
diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml
index 2efa53f0..9bac60e4 100644
--- a/helix-view/Cargo.toml
+++ b/helix-view/Cargo.toml
@@ -10,7 +10,6 @@ license = "MPL-2.0"
[features]
term = ["tui", "crossterm"]
default = ["term"]
-debug = ["helix-core/debug", "helix-lsp/debug"]
[dependencies]
anyhow = "1"
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index dd40421f..6a687955 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -13,8 +13,7 @@ use crate::{DocumentId, ViewId};
use std::collections::HashMap;
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Mode {
Normal,
Select,
@@ -53,9 +52,7 @@ 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")
@@ -74,7 +71,7 @@ impl fmt::Debug for Document {
.field("version", &self.version)
.field("diagnostics", &self.diagnostics)
// .field("language_server", &self.language_server)
- .finish_non_exhaustive()
+ .finish()
}
}
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index deb7795c..df71e2d6 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -9,7 +9,7 @@ use anyhow::Error;
pub use helix_core::diagnostic::Severity;
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Editor {
pub tree: Tree,
pub documents: SlotMap<DocumentId, Document>,
@@ -21,8 +21,7 @@ pub struct Editor {
pub status_msg: Option<(String, Severity)>,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Copy, Clone)]
+#[derive(Debug, Copy, Clone)]
pub enum Action {
Replace,
HorizontalSplit,
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs
index b5eb5d87..a0c466d9 100644
--- a/helix-view/src/tree.rs
+++ b/helix-view/src/tree.rs
@@ -4,7 +4,7 @@ use tui::layout::Rect;
// the dimensions are recomputed on windo resize/tree change.
//
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Tree {
root: ViewId,
// (container, index inside the container)
@@ -18,13 +18,13 @@ pub struct Tree {
stack: Vec<(ViewId, Rect)>,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Node {
parent: ViewId,
content: Content,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub enum Content {
View(Box<View>),
Container(Box<Container>),
@@ -48,15 +48,14 @@ impl Node {
// TODO: screen coord to container + container coordinate helpers
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(PartialEq, Eq)]
+#[derive(Debug, PartialEq, Eq)]
pub enum Layout {
Horizontal,
Vertical,
// could explore stacked/tabbed
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Container {
layout: Layout,
children: Vec<ViewId>,
@@ -437,7 +436,7 @@ impl Tree {
}
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Traverse<'a> {
tree: &'a Tree,
stack: Vec<ViewId>, // TODO: reuse the one we use on update
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index e222c11c..5d2d27fd 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -12,7 +12,7 @@ pub const PADDING: usize = 5;
type Jump = (DocumentId, Selection);
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct JumpList {
jumps: Vec<Jump>,
current: usize,
@@ -59,7 +59,7 @@ impl JumpList {
}
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct View {
pub id: ViewId,
pub doc: DocumentId,