review comments

pull/2267/head
Skyler Hawthorne 2 years ago
parent 9e64974f13
commit 31d1bbfddb

@ -427,15 +427,16 @@ impl Application {
}
pub fn handle_document_write(&mut self, doc_save_event: DocumentSavedEventResult) {
if let Err(err) = doc_save_event {
let doc_save_event = match doc_save_event {
Ok(event) => event,
Err(err) => {
self.editor.set_error(err.to_string());
return;
}
};
let doc_save_event = doc_save_event.unwrap();
let doc = self.editor.document_mut(doc_save_event.doc_id);
if doc.is_none() {
let doc = match self.editor.document_mut(doc_save_event.doc_id) {
None => {
warn!(
"received document saved event for non-existent doc id: {}",
doc_save_event.doc_id
@ -443,8 +444,8 @@ impl Application {
return;
}
let doc = doc.unwrap();
Some(doc) => doc,
};
debug!(
"document {:?} saved with revision {}",
@ -472,7 +473,7 @@ impl Application {
let loader = self.editor.syn_loader.clone();
// borrowing the same doc again to get around the borrow checker
let doc = self.editor.document_mut(doc_save_event.doc_id).unwrap();
let doc = doc_mut!(self.editor, &doc_save_event.doc_id);
let id = doc.id();
doc.detect_language(loader);
let _ = self.editor.refresh_language_server(id);

@ -21,7 +21,7 @@ pub struct TypableCommand {
}
fn quit(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
log::info!("quitting...");
log::debug!("quitting...");
if event != PromptEvent::Validate {
return Ok(());

@ -554,12 +554,7 @@ impl Document {
}
};
let identifier = if self.path().is_some() {
Some(self.identifier())
} else {
None
};
let identifier = self.path().map(|_| self.identifier());
let language_server = self.language_server.clone();
// mark changes up to now as saved
@ -708,10 +703,7 @@ impl Document {
/// and flushing through the queue of pending writes. If any fail,
/// it stops early before emptying the rest of the queue.
pub async fn close(&mut self) -> Option<DocumentSavedEventResult> {
if self.save_sender.is_some() {
self.save_sender.take();
}
self.flush_saves_impl(true).await
}

Loading…
Cancel
Save