aboutsummaryrefslogtreecommitdiff
path: root/crates/gen_lsp_server
diff options
context:
space:
mode:
Diffstat (limited to 'crates/gen_lsp_server')
-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 });