on master help sign in
add conditional noop render back

It makes it much slower without stubbing this out

commitb8a07f7d15a10186fa2b481a3423c23f32d7d561 authorSkyler Hawthorne <skyler@dead10ck.com> dateFri 24 Jun 2022, 08:39 (4 years ago) parent69c9e44
4 files changed+9−27
helix-core/src/auto_pairs.rs−1 helix-term/src/application.rs+4 helix-term/src/commands.rs+2−12 helix-term/src/commands/typed.rs+3−14
helix-core/src/auto_pairs.rs−1
@@ -7,7 +7,6 @@ use std::collections::HashMap;
77use smallvec::SmallVec;
88
99// Heavily based on https://github.com/codemirror/closebrackets/
10−
1110pub const DEFAULT_PAIRS: &[(char, char)] = &[
1211 ('(', ')'),
1312 ('{', '}'),
helix-term/src/application.rs+4
@@ -253,6 +253,10 @@ impl Application {
253253 Ok(app)
254254 }
255255
256+ #[cfg(feature = "integration")]
257+ fn render(&mut self) {}
258+
259+ #[cfg(not(feature = "integration"))]
256260 fn render(&mut self) {
257261 let compositor = &mut self.compositor;
258262
helix-term/src/commands.rs+2−12
@@ -2504,13 +2504,6 @@ fn insert_at_line_end(cx: &mut Context) {
25042504 doc.set_selection(view.id, selection);
25052505}
25062506
2507−/// Sometimes when applying formatting changes we want to mark the buffer as unmodified, for
2508−/// example because we just applied the same changes while saving.
2509−enum Modified {
2510− SetUnmodified,
2511− LeaveModified,
2512−}
2513−
25142507// Creates an LspCallback that waits for formatting changes to be computed. When they're done,
25152508// it applies them, but only if the doc hasn't changed.
25162509//
@@ -2519,7 +2512,6 @@ enum Modified {
25192512async fn make_format_callback(
25202513 doc_id: DocumentId,
25212514 doc_version: i32,
2522− modified: Modified,
25232515 format: impl Future<Output = Result<Transaction, FormatterError>> + Send + 'static,
25242516) -> anyhow::Result<job::Callback> {
25252517 let format = format.await?;
@@ -2536,17 +2528,15 @@ async fn make_format_callback(
25362528 doc.append_changes_to_history(view.id);
25372529 doc.detect_indent_and_line_ending();
25382530 view.ensure_cursor_in_view(doc, scrolloff);
2539− if let Modified::SetUnmodified = modified {
2540− doc.reset_modified();
2541− }
25422531 } else {
25432532 log::info!("discarded formatting changes because the document changed");
25442533 }
25452534 });
2535+
25462536 Ok(call)
25472537}
25482538
2549−#[derive(PartialEq)]
2539+#[derive(PartialEq, Eq)]
25502540pub enum Open {
25512541 Below,
25522542 Above,
helix-term/src/commands/typed.rs+3−14
@@ -273,12 +273,7 @@ fn write_impl(
273273 let fmt = if auto_format {
274274 doc.auto_format().map(|fmt| {
275275 let shared = fmt.shared();
276− let callback = make_format_callback(
277− doc.id(),
278− doc.version(),
279− Modified::SetUnmodified,
280− shared.clone(),
281− );
276+ let callback = make_format_callback(doc.id(), doc.version(), shared.clone());
282277 jobs.callback(callback);
283278 shared
284279 })
@@ -346,8 +341,7 @@ fn format(
346341
347342 let doc = doc!(cx.editor);
348343 if let Some(format) = doc.format() {
349− let callback =
350− make_format_callback(doc.id(), doc.version(), Modified::LeaveModified, format);
344+ let callback = make_format_callback(doc.id(), doc.version(), format);
351345 cx.jobs.callback(callback);
352346 }
353347
@@ -593,12 +587,7 @@ fn write_all_impl(
593587 let fmt = if auto_format {
594588 doc.auto_format().map(|fmt| {
595589 let shared = fmt.shared();
596− let callback = make_format_callback(
597− doc.id(),
598− doc.version(),
599− Modified::SetUnmodified,
600− shared.clone(),
601− );
590+ let callback = make_format_callback(doc.id(), doc.version(), shared.clone());
602591 jobs.callback(callback);
603592 shared
604593 })