diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 0b52681cb..6554e996f 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -165,13 +165,16 @@ impl Client { } /// Reply to a language server RPC call. - pub async fn reply( + pub fn reply( &self, id: jsonrpc::Id, result: core::result::Result, - ) -> Result<()> { + ) -> impl Future> { use jsonrpc::{Failure, Output, Success, Version}; + let server_tx = self.server_tx.clone(); + + async move { let output = match result { Ok(result) => Output::Success(Success { jsonrpc: Some(Version::V2), @@ -185,12 +188,13 @@ impl Client { }), }; - self.server_tx + server_tx .send(Payload::Response(output)) .map_err(|e| Error::Other(e.into()))?; Ok(()) } + } // ------------------------------------------------------------------------------------------- // General messages