aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-10-14 07:22:21 +0000
committerSkyler Hawthorne2022-10-19 02:31:39 +0000
commit30c93994b50888aaeb32c65c90426e997800ccea (patch)
treeb1c62f58120f58b3a12679e59e4afa1508aa8152 /helix-term/src/application.rs
parentbeb3427bfbaa88bec8b4c683e342f85eb53ad77d (diff)
Use a single save_queue on the editor
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 2e49e6d1..6010e745 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -1,5 +1,5 @@
use arc_swap::{access::Map, ArcSwap};
-use futures_util::Stream;
+use futures_util::{Stream, StreamExt};
use helix_core::{
diagnostic::{DiagnosticTag, NumberOrString},
path::get_relative_path,
@@ -968,6 +968,24 @@ impl Application {
// errors along the way
let mut errs = Vec::new();
+ // TODO: deduplicate with ctx.block_try_flush_writes
+ tokio::task::block_in_place(|| {
+ helix_lsp::block_on(async {
+ while let Some(save_event) = self.editor.save_queue.next().await {
+ match &save_event {
+ Ok(event) => {
+ let doc = doc_mut!(self.editor, &event.doc_id);
+ doc.set_last_saved_revision(event.revision);
+ }
+ Err(err) => {
+ log::error!("error saving document: {}", err);
+ }
+ };
+ // TODO: if is_err: break?
+ }
+ })
+ });
+
if let Err(err) = self
.jobs
.finish(&mut self.editor, Some(&mut self.compositor))