diff options
author | Skyler Hawthorne | 2022-06-24 12:39:07 +0000 |
---|---|---|
committer | Skyler Hawthorne | 2022-10-19 02:31:38 +0000 |
commit | b8a07f7d15a10186fa2b481a3423c23f32d7d561 (patch) | |
tree | d64eee91a5f88c7e835b4ac9aafb3e1de1e0bdc6 | |
parent | 69c9e44ef205a81c112dfb14d5f2e67e5ce9c300 (diff) |
add conditional noop render back
It makes it much slower without stubbing this out
-rw-r--r-- | helix-core/src/auto_pairs.rs | 1 | ||||
-rw-r--r-- | helix-term/src/application.rs | 4 | ||||
-rw-r--r-- | helix-term/src/commands.rs | 14 | ||||
-rw-r--r-- | helix-term/src/commands/typed.rs | 17 |
4 files changed, 9 insertions, 27 deletions
diff --git a/helix-core/src/auto_pairs.rs b/helix-core/src/auto_pairs.rs index ff680a77..edc404ac 100644 --- a/helix-core/src/auto_pairs.rs +++ b/helix-core/src/auto_pairs.rs @@ -7,7 +7,6 @@ use std::collections::HashMap; use smallvec::SmallVec; // Heavily based on https://github.com/codemirror/closebrackets/ - pub const DEFAULT_PAIRS: &[(char, char)] = &[ ('(', ')'), ('{', '}'), diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 5c25e8aa..fd9b7c3e 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -253,6 +253,10 @@ impl Application { Ok(app) } + #[cfg(feature = "integration")] + fn render(&mut self) {} + + #[cfg(not(feature = "integration"))] fn render(&mut self) { let compositor = &mut self.compositor; diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f38434e2..a4421f03 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2504,13 +2504,6 @@ fn insert_at_line_end(cx: &mut Context) { doc.set_selection(view.id, selection); } -/// Sometimes when applying formatting changes we want to mark the buffer as unmodified, for -/// example because we just applied the same changes while saving. -enum Modified { - SetUnmodified, - LeaveModified, -} - // Creates an LspCallback that waits for formatting changes to be computed. When they're done, // it applies them, but only if the doc hasn't changed. // @@ -2519,7 +2512,6 @@ enum Modified { async fn make_format_callback( doc_id: DocumentId, doc_version: i32, - modified: Modified, format: impl Future<Output = Result<Transaction, FormatterError>> + Send + 'static, ) -> anyhow::Result<job::Callback> { let format = format.await?; @@ -2536,17 +2528,15 @@ async fn make_format_callback( doc.append_changes_to_history(view.id); doc.detect_indent_and_line_ending(); view.ensure_cursor_in_view(doc, scrolloff); - if let Modified::SetUnmodified = modified { - doc.reset_modified(); - } } else { log::info!("discarded formatting changes because the document changed"); } }); + Ok(call) } -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] pub enum Open { Below, Above, diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index bc254146..14b23f2a 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -273,12 +273,7 @@ fn write_impl( let fmt = if auto_format { doc.auto_format().map(|fmt| { let shared = fmt.shared(); - let callback = make_format_callback( - doc.id(), - doc.version(), - Modified::SetUnmodified, - shared.clone(), - ); + let callback = make_format_callback(doc.id(), doc.version(), shared.clone()); jobs.callback(callback); shared }) @@ -346,8 +341,7 @@ fn format( let doc = doc!(cx.editor); if let Some(format) = doc.format() { - let callback = - make_format_callback(doc.id(), doc.version(), Modified::LeaveModified, format); + let callback = make_format_callback(doc.id(), doc.version(), format); cx.jobs.callback(callback); } @@ -593,12 +587,7 @@ fn write_all_impl( let fmt = if auto_format { doc.auto_format().map(|fmt| { let shared = fmt.shared(); - let callback = make_format_callback( - doc.id(), - doc.version(), - Modified::SetUnmodified, - shared.clone(), - ); + let callback = make_format_callback(doc.id(), doc.version(), shared.clone()); jobs.callback(callback); shared }) |