aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-02 04:55:08 +0000
committerBlaž Hrastnik2021-09-06 06:25:46 +0000
commit46f3c69f06cc55f36bcc6244a9f96c2481836dea (patch)
tree97c2a746ad1264cf171590673f14a4b8aea9672f /helix-view
parent2793ff383228403b1ebaf2a29c870a13ee76075a (diff)
lsp: Don't send notifications until initialize completes
Then send open events for all documents with the LSP attached.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index c8abd5b5..3d2d4a87 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -255,20 +255,21 @@ impl Editor {
.and_then(|language| self.language_servers.get(language).ok());
if let Some(language_server) = language_server {
- doc.set_language_server(Some(language_server.clone()));
-
let language_id = doc
.language()
.and_then(|s| s.split('.').last()) // source.rust
.map(ToOwned::to_owned)
.unwrap_or_default();
+ // TODO: this now races with on_init code if the init happens too quickly
tokio::spawn(language_server.text_document_did_open(
doc.url().unwrap(),
doc.version(),
doc.text(),
language_id,
));
+
+ doc.set_language_server(Some(language_server));
}
let id = self.documents.insert(doc);