on master help sign in
Update `client::reply` to be non async
commit80b4a690535b2171cc7db2ee6b4daf3bcb4c4f11 authorwojciechkepka <wojtek.kepka@protonmail.com> dateFri 18 Jun 2021, 05:40 (5 years ago) parenta6d3958
1 file changed+7−3
helix-lsp/src/client.rs+7−3
helix-lsp/src/client.rs+7−3
@@ -165,13 +165,16 @@ impl Client {
165165 }
166166
167167 /// Reply to a language server RPC call.
168− pub async fn reply(
168+ pub fn reply(
169169 &self,
170170 id: jsonrpc::Id,
171171 result: core::result::Result<Value, jsonrpc::Error>,
172− ) -> Result<()> {
172+ ) -> impl Future<Output = Result<()>> {
173173 use jsonrpc::{Failure, Output, Success, Version};
174174
175+ let server_tx = self.server_tx.clone();
176+
177+ async move {
175178 let output = match result {
176179 Ok(result) => Output::Success(Success {
177180 jsonrpc: Some(Version::V2),
@@ -185,12 +188,13 @@ impl Client {
185188 }),
186189 };
187190
188− self.server_tx
191+ server_tx
189192 .send(Payload::Response(output))
190193 .map_err(|e| Error::Other(e.into()))?;
191194
192195 Ok(())
193196 }
197+ }
194198
195199 // -------------------------------------------------------------------------------------------
196200 // General messages