From d00414f81a49501277642868c2cf76eefeb0db6b Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Thu, 6 May 2021 15:08:59 +0900 Subject: Start moving more LSP calls into callbacks/futures without capturing self --- helix-view/src/editor.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 014364e0..44014e83 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -131,14 +131,12 @@ impl Editor { .map(ToOwned::to_owned) .unwrap_or_default(); - let rt = tokio::runtime::Handle::current(); - rt.block_on(language_server.text_document_did_open( + tokio::spawn(language_server.text_document_did_open( doc.url().unwrap(), doc.version(), doc.text(), language_id, - )) - .unwrap(); + )); } let id = self.documents.insert(doc); @@ -162,9 +160,7 @@ impl Editor { .and_then(|language| language_servers.get(language)); if let Some(language_server) = language_server { - let rt = tokio::runtime::Handle::current(); - rt.block_on(language_server.text_document_did_close(doc.identifier())) - .unwrap(); + tokio::spawn(language_server.text_document_did_close(doc.identifier())); } // remove selection -- cgit v1.2.3-70-g09d2