From 6cbfb050e2c99acf5cdfe7d981c262fbdeaf761c Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 12 Mar 2021 16:20:56 +0900 Subject: lsp: Emit didSave notifications. --- helix-view/src/document.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'helix-view') diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index b79e201d..f394f2be 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -111,10 +111,13 @@ impl Document { let text = self.text().clone(); let path = self.path.clone().expect("Can't save with no path set!"); // TODO: handle no path + let identifier = self.identifier(); // TODO: mark changes up to now as saved // TODO: mark dirty false + let language_server = self.language_server.clone(); + async move { use smol::{fs::File, prelude::*}; let mut file = File::create(path).await?; @@ -125,8 +128,14 @@ impl Document { } // TODO: flush? + if let Some(language_server) = language_server { + language_server + .text_document_did_save(identifier, &text) + .await?; + } + Ok(()) - } // and_then notify save + } } pub fn set_language( -- cgit v1.2.3-70-g09d2