We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f011c25 commit 577d0f9Copy full SHA for 577d0f9
crates/pg_lsp/src/server.rs
@@ -59,16 +59,23 @@ fn get_client_receiver(
59
let (message_tx, message_rx) = mpsc::unbounded_channel();
60
61
tokio::task::spawn(async move {
62
- // TODO: improve Result handling
63
loop {
64
- let msg = connection.receiver.recv().unwrap();
+ let msg = match connection.receiver.recv() {
+ Ok(msg) => msg,
65
+ Err(e) => {
66
+ eprint!("Connection was closed by LSP client: {}", e);
67
+ cancel_token.cancel();
68
+ return;
69
+ }
70
+ };
71
72
match msg {
73
Message::Request(r) if connection.handle_shutdown(&r).unwrap() => {
74
cancel_token.cancel();
75
return;
76
}
77
78
+ // any non-shutdown request is forwarded to the server
79
_ => message_tx.send(msg).unwrap(),
80
};
81
0 commit comments