aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-17 06:51:12 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-17 06:51:12 +0100
commitd3afb1b3782683c3e800b38b4c24b7581918fb7f (patch)
treed9a37343c1227c94eaefc54671ddb562faeaf20c /crates
parent0e35603069b4f3cee97641204b09d91fd723d01d (diff)
parent8d569d49d2508cd7b50dd3d00d5509d4128bf645 (diff)
Merge #1153
1153: "Restart server" command r=jrvidal a=jrvidal The only tricky aspect is that fact that once the `exit` command has been received, we no longer need to join on the reader thread. Also, I think `terminateProcesses.sh` was not working properly. In fact, the very same script from the vscode language server implementation is not working either! It's because of that I noticed the reader thread issue :open_mouth: Co-authored-by: Roberto Vidal <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/gen_lsp_server/src/stdio.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/gen_lsp_server/src/stdio.rs b/crates/gen_lsp_server/src/stdio.rs
index dab2d8da8..5edfbc39c 100644
--- a/crates/gen_lsp_server/src/stdio.rs
+++ b/crates/gen_lsp_server/src/stdio.rs
@@ -5,6 +5,7 @@ use std::{
5 5
6use crossbeam_channel::{bounded, Receiver, Sender}; 6use crossbeam_channel::{bounded, Receiver, Sender};
7use failure::bail; 7use failure::bail;
8use lsp_types::notification::Exit;
8 9
9use crate::{RawMessage, Result}; 10use crate::{RawMessage, Result};
10 11
@@ -21,9 +22,18 @@ pub fn stdio_transport() -> (Receiver<RawMessage>, Sender<RawMessage>, Threads)
21 let stdin = stdin(); 22 let stdin = stdin();
22 let mut stdin = stdin.lock(); 23 let mut stdin = stdin.lock();
23 while let Some(msg) = RawMessage::read(&mut stdin)? { 24 while let Some(msg) = RawMessage::read(&mut stdin)? {
25 let is_exit = match &msg {
26 RawMessage::Notification(n) => n.is::<Exit>(),
27 _ => false,
28 };
29
24 if let Err(_) = reader_sender.send(msg) { 30 if let Err(_) = reader_sender.send(msg) {
25 break; 31 break;
26 } 32 }
33
34 if is_exit {
35 break;
36 }
27 } 37 }
28 Ok(()) 38 Ok(())
29 }); 39 });