aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwojciechkepka2021-06-18 03:40:57 +0000
committerBlaž Hrastnik2021-06-18 08:42:38 +0000
commit80b4a690535b2171cc7db2ee6b4daf3bcb4c4f11 (patch)
tree1f9ca9192a09644b6594675dc86cfff8c79eda3f
parenta6d39585d8a1cf260262e7f3e3c4741791582049 (diff)
Update `client::reply` to be non async
-rw-r--r--helix-lsp/src/client.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 0b52681c..6554e996 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<Value, jsonrpc::Error>,
- ) -> Result<()> {
+ ) -> impl Future<Output = Result<()>> {
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