aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-02 07:07:21 +0000
committerBlaž Hrastnik2021-09-06 06:25:46 +0000
commit64099af3f1f5957de8f4203c665063d02ba4bac9 (patch)
tree82e3cbdbe5f0dd290b04cef5d3f88f10d278cc26 /helix-view
parentade1a453efe8bc6d4c5e775ba39da149ef01bb6b (diff)
Don't panic on save if language_server isn't initialized
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 362a433e..6de60995 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -471,10 +471,15 @@ impl Document {
let mut file = File::create(path).await?;
to_writer(&mut file, encoding, &text).await?;
- if let Some(notification) = language_server.and_then(|language_server| {
- language_server.text_document_did_save(identifier, &text)
- }) {
- notification.await?;
+ if let Some(language_server) = language_server {
+ if language_server.is_initialized() {
+ return Ok(());
+ }
+ if let Some(notification) =
+ language_server.text_document_did_save(identifier, &text)
+ {
+ notification.await?;
+ }
}
Ok(())