mirror of
https://github.com/helix-editor/helix
synced 2024-11-10 10:34:45 +01:00
Update client::reply
to be non async
This commit is contained in:
parent
a6d39585d8
commit
80b4a69053
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user