diff options
author | wojciechkepka | 2021-06-18 03:42:34 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-18 08:42:38 +0000 |
commit | 38cb934d8f579663ff13496bf79293103863b60b (patch) | |
tree | 3dbd92d6032921381ded7e02e0bd36747e9c2e0f /helix-lsp/src/transport.rs | |
parent | 80b4a690535b2171cc7db2ee6b4daf3bcb4c4f11 (diff) |
Add unique id to each lsp client/server pair
Diffstat (limited to 'helix-lsp/src/transport.rs')
-rw-r--r-- | helix-lsp/src/transport.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs index e8068323..29ce2e84 100644 --- a/helix-lsp/src/transport.rs +++ b/helix-lsp/src/transport.rs @@ -33,7 +33,8 @@ enum ServerMessage { #[derive(Debug)] pub struct Transport { - client_tx: UnboundedSender<jsonrpc::Call>, + id: usize, + client_tx: UnboundedSender<(usize, jsonrpc::Call)>, client_rx: UnboundedReceiver<Payload>, pending_requests: HashMap<jsonrpc::Id, Sender<Result<Value>>>, @@ -48,11 +49,16 @@ impl Transport { server_stdout: BufReader<ChildStdout>, server_stdin: BufWriter<ChildStdin>, server_stderr: BufReader<ChildStderr>, - ) -> (UnboundedReceiver<jsonrpc::Call>, UnboundedSender<Payload>) { + id: usize, + ) -> ( + UnboundedReceiver<(usize, jsonrpc::Call)>, + UnboundedSender<Payload>, + ) { let (client_tx, rx) = unbounded_channel(); let (tx, client_rx) = unbounded_channel(); let transport = Self { + id, server_stdout, server_stdin, server_stderr, @@ -156,7 +162,7 @@ impl Transport { match msg { ServerMessage::Output(output) => self.process_request_response(output).await?, ServerMessage::Call(call) => { - self.client_tx.send(call).unwrap(); + self.client_tx.send((self.id, call)).unwrap(); // let notification = Notification::parse(&method, params); } }; |