summaryrefslogtreecommitdiff
path: root/helix-lsp/src/transport.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-20 04:58:34 +0000
committerBlaž Hrastnik2020-12-03 04:10:32 +0000
commitf9bfba4d96f80eb41beb91702558f6f165a0e70f (patch)
treee2e0296a01645cdcb7782a9bd8b4f1a55d3fbfd9 /helix-lsp/src/transport.rs
parent64b5b23315f12125a2c5b2f810fe5ac285bdfa79 (diff)
Reroute LSP notification events into the main app event loop.
Diffstat (limited to 'helix-lsp/src/transport.rs')
-rw-r--r--helix-lsp/src/transport.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs
index c44ffa91..8915a925 100644
--- a/helix-lsp/src/transport.rs
+++ b/helix-lsp/src/transport.rs
@@ -24,7 +24,7 @@ pub(crate) enum Payload {
}
pub(crate) struct Transport {
- incoming: Sender<Message>,
+ incoming: Sender<Notification>, // TODO Notification | Call
outgoing: Receiver<Payload>,
pending_requests: HashMap<jsonrpc::Id, Sender<anyhow::Result<Value>>>,
@@ -39,7 +39,7 @@ impl Transport {
ex: &Executor,
reader: BufReader<ChildStdout>,
writer: BufWriter<ChildStdin>,
- ) -> (Receiver<Message>, Sender<Payload>) {
+ ) -> (Receiver<Notification>, Sender<Payload>) {
let (incoming, rx) = smol::channel::unbounded();
let (tx, outgoing) = smol::channel::unbounded();
@@ -111,7 +111,7 @@ impl Transport {
}
pub async fn send(&mut self, request: String) -> anyhow::Result<()> {
- println!("-> {}", request);
+ // println!("-> {}", request);
// send the headers
self.writer
@@ -132,11 +132,11 @@ impl Transport {
Message::Notification(jsonrpc::Notification { method, params, .. }) => {
let notification = Notification::parse(&method, params);
- println!("<- {} {:?}", method, notification);
- // dispatch
+ // println!("<- {} {:?}", method, notification);
+ self.incoming.send(notification).await?;
}
Message::Call(call) => {
- println!("<- {:?}", call);
+ // println!("<- {:?}", call);
// dispatch
}
_ => unreachable!(),
@@ -147,7 +147,7 @@ impl Transport {
pub async fn recv_response(&mut self, output: jsonrpc::Output) -> anyhow::Result<()> {
match output {
jsonrpc::Output::Success(jsonrpc::Success { id, result, .. }) => {
- println!("<- {}", result);
+ // println!("<- {}", result);
let tx = self
.pending_requests