@@ -89,14 +89,14 @@ impl Serialize for Mode {
90/// A snapshot of the text of a document that we want to write out to disk
90/// A snapshot of the text of a document that we want to write out to disk
91#[derive(Debug, Clone)]
91#[derive(Debug, Clone)]
92−pub struct DocumentSaveEvent {
92+pub struct DocumentSavedEvent {
93 pub revision: usize,
93 pub revision: usize,
94 pub doc_id: DocumentId,
94 pub doc_id: DocumentId,
95 pub path: PathBuf,
95 pub path: PathBuf,
98−pub type DocumentSaveEventResult = Result<DocumentSaveEvent, anyhow::Error>;
98+pub type DocumentSavedEventResult = Result<DocumentSavedEvent, anyhow::Error>;
99−pub type DocumentSaveEventFuture = BoxFuture<'static, DocumentSaveEventResult>;
99+pub type DocumentSavedEventFuture = BoxFuture<'static, DocumentSavedEventResult>;
101pub struct Document {
101pub struct Document {
102 pub(crate) id: DocumentId,
102 pub(crate) id: DocumentId,
@@ -133,9 +133,9 @@ pub struct Document {
133 last_saved_revision: usize,
133 last_saved_revision: usize,
134 version: i32, // should be usize?
134 version: i32, // should be usize?
135 pub(crate) modified_since_accessed: bool,
135 pub(crate) modified_since_accessed: bool,
136− save_sender: Option<UnboundedSender<DocumentSaveEventFuture>>,
136+ save_sender: Option<UnboundedSender<DocumentSavedEventFuture>>,
137− save_receiver: Option<UnboundedReceiver<DocumentSaveEventFuture>>,
137+ save_receiver: Option<UnboundedReceiver<DocumentSavedEventFuture>>,
138− current_save: Arc<Mutex<Option<DocumentSaveEventFuture>>>,
138+ current_save: Arc<Mutex<Option<DocumentSavedEventFuture>>>,
140 diagnostics: Vec<Diagnostic>,
140 diagnostics: Vec<Diagnostic>,
141 language_server: Option<Arc<helix_lsp::Client>>,
141 language_server: Option<Arc<helix_lsp::Client>>,
@@ -616,7 +616,7 @@ impl Document {
616 let mut file = File::create(&path).await?;
616 let mut file = File::create(&path).await?;
617 to_writer(&mut file, encoding, &text).await?;
617 to_writer(&mut file, encoding, &text).await?;
619− let event = DocumentSaveEvent {
619+ let event = DocumentSavedEvent {
620 revision: current_rev,
620 revision: current_rev,
@@ -643,11 +643,11 @@ impl Document {
643 .map_err(|err| anyhow!("failed to send save event: {}", err))
643 .map_err(|err| anyhow!("failed to send save event: {}", err))
646− pub async fn await_save(&mut self) -> Option<DocumentSaveEventResult> {
646+ pub async fn await_save(&mut self) -> Option<DocumentSavedEventResult> {
647 self.await_save_impl(true).await
647 self.await_save_impl(true).await
650− async fn await_save_impl(&mut self, block: bool) -> Option<DocumentSaveEventResult> {
650+ async fn await_save_impl(&mut self, block: bool) -> Option<DocumentSavedEventResult> {
651 let mut current_save = self.current_save.lock().await;
651 let mut current_save = self.current_save.lock().await;
652 if let Some(ref mut save) = *current_save {
652 if let Some(ref mut save) = *current_save {
653 log::trace!("reawaiting save of '{:?}'", self.path());
653 log::trace!("reawaiting save of '{:?}'", self.path());
@@ -698,11 +698,11 @@ impl Document {
699 /// Flushes the queue of pending writes. If any fail,
699 /// Flushes the queue of pending writes. If any fail,
700 /// it stops early before emptying the rest of the queue.
700 /// it stops early before emptying the rest of the queue.
701− pub async fn try_flush_saves(&mut self) -> Option<DocumentSaveEventResult> {
701+ pub async fn try_flush_saves(&mut self) -> Option<DocumentSavedEventResult> {
702 self.flush_saves_impl(false).await
702 self.flush_saves_impl(false).await
705− async fn flush_saves_impl(&mut self, block: bool) -> Option<DocumentSaveEventResult> {
705+ async fn flush_saves_impl(&mut self, block: bool) -> Option<DocumentSavedEventResult> {
706 let mut final_result = None;
706 let mut final_result = None;
708 while let Some(save_event) = self.await_save_impl(block).await {
708 while let Some(save_event) = self.await_save_impl(block).await {
@@ -734,7 +734,7 @@ impl Document {
734 /// Prepares the Document for being closed by stopping any new writes
734 /// Prepares the Document for being closed by stopping any new writes
735 /// and flushing through the queue of pending writes. If any fail,
735 /// and flushing through the queue of pending writes. If any fail,
736 /// it stops early before emptying the rest of the queue.
736 /// it stops early before emptying the rest of the queue.
737− pub async fn close(&mut self) -> Option<DocumentSaveEventResult> {
737+ pub async fn close(&mut self) -> Option<DocumentSavedEventResult> {
738 if self.save_sender.is_some() {
738 if self.save_sender.is_some() {
739 self.save_sender.take();
739 self.save_sender.take();