diff options
-rw-r--r-- | crates/gen_lsp_server/src/stdio.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/tests/heavy_tests/support.rs | 15 |
2 files changed, 6 insertions, 13 deletions
diff --git a/crates/gen_lsp_server/src/stdio.rs b/crates/gen_lsp_server/src/stdio.rs index 5edfbc39c..2d6418400 100644 --- a/crates/gen_lsp_server/src/stdio.rs +++ b/crates/gen_lsp_server/src/stdio.rs | |||
@@ -27,9 +27,7 @@ pub fn stdio_transport() -> (Receiver<RawMessage>, Sender<RawMessage>, Threads) | |||
27 | _ => false, | 27 | _ => false, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | if let Err(_) = reader_sender.send(msg) { | 30 | reader_sender.send(msg).unwrap(); |
31 | break; | ||
32 | } | ||
33 | 31 | ||
34 | if is_exit { | 32 | if is_exit { |
35 | break; | 33 | break; |
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index b07882700..d68182174 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs | |||
@@ -77,7 +77,7 @@ pub struct Server { | |||
77 | req_id: Cell<u64>, | 77 | req_id: Cell<u64>, |
78 | messages: RefCell<Vec<RawMessage>>, | 78 | messages: RefCell<Vec<RawMessage>>, |
79 | dir: TempDir, | 79 | dir: TempDir, |
80 | worker: Option<Worker<RawMessage, RawMessage>>, | 80 | worker: Worker<RawMessage, RawMessage>, |
81 | } | 81 | } |
82 | 82 | ||
83 | impl Server { | 83 | impl Server { |
@@ -99,12 +99,7 @@ impl Server { | |||
99 | .unwrap() | 99 | .unwrap() |
100 | }, | 100 | }, |
101 | ); | 101 | ); |
102 | let res = Server { | 102 | let res = Server { req_id: Cell::new(1), dir, messages: Default::default(), worker }; |
103 | req_id: Cell::new(1), | ||
104 | dir, | ||
105 | messages: Default::default(), | ||
106 | worker: Some(worker), | ||
107 | }; | ||
108 | 103 | ||
109 | for (path, text) in files { | 104 | for (path, text) in files { |
110 | res.send_notification(RawNotification::new::<DidOpenTextDocument>( | 105 | res.send_notification(RawNotification::new::<DidOpenTextDocument>( |
@@ -157,7 +152,7 @@ impl Server { | |||
157 | } | 152 | } |
158 | fn send_request_(&self, r: RawRequest) -> Value { | 153 | fn send_request_(&self, r: RawRequest) -> Value { |
159 | let id = r.id; | 154 | let id = r.id; |
160 | self.worker.as_ref().unwrap().sender().send(RawMessage::Request(r)).unwrap(); | 155 | self.worker.sender().send(RawMessage::Request(r)).unwrap(); |
161 | while let Some(msg) = self.recv() { | 156 | while let Some(msg) = self.recv() { |
162 | match msg { | 157 | match msg { |
163 | RawMessage::Request(req) => panic!("unexpected request: {:?}", req), | 158 | RawMessage::Request(req) => panic!("unexpected request: {:?}", req), |
@@ -197,13 +192,13 @@ impl Server { | |||
197 | } | 192 | } |
198 | } | 193 | } |
199 | fn recv(&self) -> Option<RawMessage> { | 194 | fn recv(&self) -> Option<RawMessage> { |
200 | recv_timeout(&self.worker.as_ref().unwrap().receiver()).map(|msg| { | 195 | recv_timeout(&self.worker.receiver()).map(|msg| { |
201 | self.messages.borrow_mut().push(msg.clone()); | 196 | self.messages.borrow_mut().push(msg.clone()); |
202 | msg | 197 | msg |
203 | }) | 198 | }) |
204 | } | 199 | } |
205 | fn send_notification(&self, not: RawNotification) { | 200 | fn send_notification(&self, not: RawNotification) { |
206 | self.worker.as_ref().unwrap().sender().send(RawMessage::Notification(not)).unwrap(); | 201 | self.worker.sender().send(RawMessage::Notification(not)).unwrap(); |
207 | } | 202 | } |
208 | 203 | ||
209 | pub fn path(&self) -> &Path { | 204 | pub fn path(&self) -> &Path { |