diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 6 | ||||
-rw-r--r-- | crates/ra_lsp_server/tests/heavy_tests/main.rs | 10 | ||||
-rw-r--r-- | crates/ra_lsp_server/tests/heavy_tests/support.rs | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 145f7bf65..fb2305b26 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -63,7 +63,7 @@ pub fn main_loop( | |||
63 | Err(e) => { | 63 | Err(e) => { |
64 | log::error!("loading workspace failed: {}", e); | 64 | log::error!("loading workspace failed: {}", e); |
65 | 65 | ||
66 | feedback( | 66 | show_message( |
67 | req::MessageType::Error, | 67 | req::MessageType::Error, |
68 | format!("rust-analyzer failed to load workspace: {}", e), | 68 | format!("rust-analyzer failed to load workspace: {}", e), |
69 | msg_sender, | 69 | msg_sender, |
@@ -247,7 +247,7 @@ fn main_loop_inner( | |||
247 | && pending_libraries.is_empty() | 247 | && pending_libraries.is_empty() |
248 | && in_flight_libraries == 0 | 248 | && in_flight_libraries == 0 |
249 | { | 249 | { |
250 | feedback(req::MessageType::Info, "workspace loaded", msg_sender); | 250 | show_message(req::MessageType::Info, "workspace loaded", msg_sender); |
251 | // Only send the notification first time | 251 | // Only send the notification first time |
252 | send_workspace_notification = false; | 252 | send_workspace_notification = false; |
253 | } | 253 | } |
@@ -505,7 +505,7 @@ fn update_file_notifications_on_threadpool( | |||
505 | }); | 505 | }); |
506 | } | 506 | } |
507 | 507 | ||
508 | fn feedback<M: Into<String>>(typ: req::MessageType, msg: M, sender: &Sender<RawMessage>) { | 508 | fn show_message<M: Into<String>>(typ: req::MessageType, msg: M, sender: &Sender<RawMessage>) { |
509 | let not = RawNotification::new::<req::ShowMessage>(&req::ShowMessageParams { | 509 | let not = RawNotification::new::<req::ShowMessage>(&req::ShowMessageParams { |
510 | typ, | 510 | typ, |
511 | message: msg.into(), | 511 | message: msg.into(), |
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index 996bf8e01..1c099a78f 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs | |||
@@ -31,7 +31,7 @@ version = "0.0.0" | |||
31 | use std::collections::Spam; | 31 | use std::collections::Spam; |
32 | "#, | 32 | "#, |
33 | ); | 33 | ); |
34 | server.wait_for_feedback("workspace loaded"); | 34 | server.wait_for_message("workspace loaded"); |
35 | eprintln!("loading took {:?}", project_start.elapsed()); | 35 | eprintln!("loading took {:?}", project_start.elapsed()); |
36 | let completion_start = Instant::now(); | 36 | let completion_start = Instant::now(); |
37 | let res = server.send_request::<Completion>(CompletionParams { | 37 | let res = server.send_request::<Completion>(CompletionParams { |
@@ -53,7 +53,7 @@ fn foo() { | |||
53 | } | 53 | } |
54 | ", | 54 | ", |
55 | ); | 55 | ); |
56 | server.wait_for_feedback("workspace loaded"); | 56 | server.wait_for_message("workspace loaded"); |
57 | server.request::<Runnables>( | 57 | server.request::<Runnables>( |
58 | RunnablesParams { text_document: server.doc_id("lib.rs"), position: None }, | 58 | RunnablesParams { text_document: server.doc_id("lib.rs"), position: None }, |
59 | json!([ | 59 | json!([ |
@@ -107,7 +107,7 @@ pub fn foo() {} | |||
107 | fn test_eggs() {} | 107 | fn test_eggs() {} |
108 | "#, | 108 | "#, |
109 | ); | 109 | ); |
110 | server.wait_for_feedback("workspace loaded"); | 110 | server.wait_for_message("workspace loaded"); |
111 | server.request::<Runnables>( | 111 | server.request::<Runnables>( |
112 | RunnablesParams { | 112 | RunnablesParams { |
113 | text_document: server.doc_id("tests/spam.rs"), | 113 | text_document: server.doc_id("tests/spam.rs"), |
@@ -167,7 +167,7 @@ fn main() { | |||
167 | pub use std::collections::HashMap; | 167 | pub use std::collections::HashMap; |
168 | "#, | 168 | "#, |
169 | ); | 169 | ); |
170 | server.wait_for_feedback("workspace loaded"); | 170 | server.wait_for_message("workspace loaded"); |
171 | 171 | ||
172 | server.request::<Formatting>( | 172 | server.request::<Formatting>( |
173 | DocumentFormattingParams { | 173 | DocumentFormattingParams { |
@@ -216,7 +216,7 @@ mod bar; | |||
216 | fn main() {} | 216 | fn main() {} |
217 | "#, | 217 | "#, |
218 | ); | 218 | ); |
219 | server.wait_for_feedback("workspace loaded"); | 219 | server.wait_for_message("workspace loaded"); |
220 | let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None }; | 220 | let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None }; |
221 | server.request::<CodeActionRequest>( | 221 | server.request::<CodeActionRequest>( |
222 | CodeActionParams { | 222 | CodeActionParams { |
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index 3a7c50309..08f7ad6fd 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs | |||
@@ -134,14 +134,14 @@ impl Server { | |||
134 | } | 134 | } |
135 | panic!("no response"); | 135 | panic!("no response"); |
136 | } | 136 | } |
137 | pub fn wait_for_feedback(&self, feedback: &str) { | 137 | pub fn wait_for_message(&self, message: &str) { |
138 | self.wait_for_feedback_n(feedback, 1) | 138 | self.wait_for_message_n(message, 1) |
139 | } | 139 | } |
140 | pub fn wait_for_feedback_n(&self, feedback: &str, n: usize) { | 140 | pub fn wait_for_message_n(&self, message: &str, n: usize) { |
141 | let f = |msg: &RawMessage| match msg { | 141 | let f = |msg: &RawMessage| match msg { |
142 | RawMessage::Notification(n) if n.method == ShowMessage::METHOD => { | 142 | RawMessage::Notification(n) if n.method == ShowMessage::METHOD => { |
143 | let message = n.clone().cast::<req::ShowMessage>().unwrap(); | 143 | let msg = n.clone().cast::<req::ShowMessage>().unwrap(); |
144 | message.message == feedback | 144 | msg.message == message |
145 | } | 145 | } |
146 | _ => false, | 146 | _ => false, |
147 | }; | 147 | }; |