@@ -1,12 +1,11 @@
1use crate::{regex::Regex, Change, Rope, RopeSlice, Transaction};
1use crate::{regex::Regex, Change, Rope, RopeSlice, Transaction};
2pub use helix_syntax::{get_language, get_language_name, Lang};
2pub use helix_syntax::{get_language, get_language_name, Lang};
4−#[cfg(feature = "debug")]
7 borrow::Cow,
5 borrow::Cow,
8 cell::RefCell,
6 cell::RefCell,
9 collections::{HashMap, HashSet},
7 collections::{HashMap, HashSet},
10 path::{Path, PathBuf},
9 path::{Path, PathBuf},
11 sync::Arc,
10 sync::Arc,
@@ -14,15 +13,13 @@ use std::{
14use once_cell::sync::{Lazy, OnceCell};
13use once_cell::sync::{Lazy, OnceCell};
15use serde::{Deserialize, Serialize};
14use serde::{Deserialize, Serialize};
17−#[cfg_attr(feature = "debug", derive(Debug))]
18−#[derive(Serialize, Deserialize)]
16+#[derive(Debug, Serialize, Deserialize)]
19pub struct Configuration {
17pub struct Configuration {
20 pub language: Vec<LanguageConfiguration>,
18 pub language: Vec<LanguageConfiguration>,
23// largely based on tree-sitter/cli/src/loader.rs
21// largely based on tree-sitter/cli/src/loader.rs
24−#[cfg_attr(feature = "debug", derive(Debug))]
25−#[derive(Serialize, Deserialize)]
22+#[derive(Debug, Serialize, Deserialize)]
26#[serde(rename_all = "kebab-case")]
23#[serde(rename_all = "kebab-case")]
27pub struct LanguageConfiguration {
24pub struct LanguageConfiguration {
28 #[serde(rename = "name")]
25 #[serde(rename = "name")]
@@ -50,8 +47,7 @@ pub struct LanguageConfiguration {
50 pub(crate) indent_query: OnceCell<Option<IndentQuery>>,
47 pub(crate) indent_query: OnceCell<Option<IndentQuery>>,
53−#[cfg_attr(feature = "debug", derive(Debug))]
54−#[derive(Serialize, Deserialize)]
50+#[derive(Debug, Serialize, Deserialize)]
55#[serde(rename_all = "kebab-case")]
51#[serde(rename_all = "kebab-case")]
56pub struct LanguageServerConfiguration {
52pub struct LanguageServerConfiguration {
57 pub command: String,
53 pub command: String,
@@ -60,16 +56,14 @@ pub struct LanguageServerConfiguration {
60 pub args: Vec<String>,
56 pub args: Vec<String>,
63−#[cfg_attr(feature = "debug", derive(Debug))]
64−#[derive(Serialize, Deserialize)]
59+#[derive(Debug, Serialize, Deserialize)]
65#[serde(rename_all = "kebab-case")]
60#[serde(rename_all = "kebab-case")]
66pub struct IndentationConfiguration {
61pub struct IndentationConfiguration {
67 pub tab_width: usize,
62 pub tab_width: usize,
68 pub unit: String,
63 pub unit: String,
71−#[cfg_attr(feature = "debug", derive(Debug))]
72−#[derive(Serialize, Deserialize)]
66+#[derive(Debug, Serialize, Deserialize)]
73#[serde(rename_all = "kebab-case")]
67#[serde(rename_all = "kebab-case")]
74pub struct IndentQuery {
68pub struct IndentQuery {
75 #[serde(default)]
69 #[serde(default)]
@@ -196,7 +190,7 @@ impl LanguageConfiguration {
197pub static LOADER: OnceCell<Loader> = OnceCell::new();
191pub static LOADER: OnceCell<Loader> = OnceCell::new();
199−#[cfg_attr(feature = "debug", derive(Debug))]
193+#[derive(Debug)]
200pub struct Loader {
194pub struct Loader {
201 // highlight_names ?
195 // highlight_names ?
202 language_configs: Vec<Arc<LanguageConfiguration>>,
196 language_configs: Vec<Arc<LanguageConfiguration>>,
@@ -264,10 +258,9 @@ pub struct TsParser {
264 cursors: Vec<QueryCursor>,
258 cursors: Vec<QueryCursor>,
267−#[cfg(feature = "debug")]
268impl fmt::Debug for TsParser {
261impl fmt::Debug for TsParser {
269 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
262 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
270− f.debug_struct("TsParser").finish_non_exhaustive()
263+ f.debug_struct("TsParser").finish()
@@ -279,7 +272,7 @@ thread_local! {
282−#[cfg_attr(feature = "debug", derive(Debug))]
275+#[derive(Debug)]
283pub struct Syntax {
276pub struct Syntax {
284 config: Arc<HighlightConfiguration>,
277 config: Arc<HighlightConfiguration>,
@@ -460,7 +453,7 @@ impl Syntax {
460 // buffer_range_for_scope_at_pos
453 // buffer_range_for_scope_at_pos
463−#[cfg_attr(feature = "debug", derive(Debug))]
456+#[derive(Debug)]
464pub struct LanguageLayer {
457pub struct LanguageLayer {
466 // grammar
459 // grammar
@@ -769,7 +762,7 @@ pub enum HighlightEvent {
769/// Contains the data neeeded to higlight code written in a particular language.
762/// Contains the data neeeded to higlight code written in a particular language.
771/// This struct is immutable and can be shared between threads.
764/// This struct is immutable and can be shared between threads.
772−#[cfg_attr(feature = "debug", derive(Debug))]
765+#[derive(Debug)]
773pub struct HighlightConfiguration {
766pub struct HighlightConfiguration {
774 pub language: Grammar,
767 pub language: Grammar,
775 pub query: Query,
768 pub query: Query,
@@ -800,7 +793,7 @@ struct LocalScope<'a> {
800 local_defs: Vec<LocalDef<'a>>,
793 local_defs: Vec<LocalDef<'a>>,
803−#[cfg_attr(feature = "debug", derive(Debug))]
796+#[derive(Debug)]
804struct HighlightIter<'a, 'tree: 'a, F>
797struct HighlightIter<'a, 'tree: 'a, F>
806 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
799 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
@@ -826,10 +819,9 @@ struct HighlightIterLayer<'a, 'tree: 'a> {
826 depth: usize,
819 depth: usize,
829−#[cfg(feature = "debug")]
830impl<'a, 'tree: 'a> fmt::Debug for HighlightIterLayer<'a, 'tree> {
822impl<'a, 'tree: 'a> fmt::Debug for HighlightIterLayer<'a, 'tree> {
831 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
823 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
832− f.debug_struct("HighlightIterLayer").finish_non_exhaustive()
824+ f.debug_struct("HighlightIterLayer").finish()