on master help sign in
Update `client::reply` to be non async
80b4a69wojciechkepka
helix-lsp/src/client.rs+7−3
@@ -165,13 +165,16 @@ impl Client {
165 }
165 }
166
166
167 /// Reply to a language server RPC call.
167 /// Reply to a language server RPC call.
168− pub async fn reply(
168+ pub fn reply(
169 &self,
169 &self,
170 id: jsonrpc::Id,
170 id: jsonrpc::Id,
171 result: core::result::Result<Value, jsonrpc::Error>,
171 result: core::result::Result<Value, jsonrpc::Error>,
172− ) -> Result<()> {
172+ ) -> impl Future<Output = Result<()>> {
173 use jsonrpc::{Failure, Output, Success, Version};
173 use jsonrpc::{Failure, Output, Success, Version};
174
174
175+ let server_tx = self.server_tx.clone();
176+
177+ async move {
175 let output = match result {
178 let output = match result {
176 Ok(result) => Output::Success(Success {
179 Ok(result) => Output::Success(Success {
177 jsonrpc: Some(Version::V2),
180 jsonrpc: Some(Version::V2),
@@ -185,12 +188,13 @@ impl Client {
185 }),
188 }),
186 };
189 };
187
190
188− self.server_tx
191+ server_tx
189 .send(Payload::Response(output))
192 .send(Payload::Response(output))
190 .map_err(|e| Error::Other(e.into()))?;
193 .map_err(|e| Error::Other(e.into()))?;
191
194
192 Ok(())
195 Ok(())
193 }
196 }
197+ }
194
198
195 // -------------------------------------------------------------------------------------------
199 // -------------------------------------------------------------------------------------------
196 // General messages
200 // General messages