diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/support.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index e28ae61fe..1d7062bdf 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -12,13 +12,14 @@ use lsp_types::{ | |||
12 | notification::{DidOpenTextDocument, Exit}, | 12 | notification::{DidOpenTextDocument, Exit}, |
13 | request::Shutdown, | 13 | request::Shutdown, |
14 | ClientCapabilities, DidOpenTextDocumentParams, GotoCapability, TextDocumentClientCapabilities, | 14 | ClientCapabilities, DidOpenTextDocumentParams, GotoCapability, TextDocumentClientCapabilities, |
15 | TextDocumentIdentifier, TextDocumentItem, Url, | 15 | TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, |
16 | }; | 16 | }; |
17 | use serde::Serialize; | 17 | use serde::Serialize; |
18 | use serde_json::{to_string_pretty, Value}; | 18 | use serde_json::{to_string_pretty, Value}; |
19 | use tempfile::TempDir; | 19 | use tempfile::TempDir; |
20 | use test_utils::{find_mismatch, parse_fixture}; | 20 | use test_utils::{find_mismatch, parse_fixture}; |
21 | 21 | ||
22 | use req::{ProgressParams, ProgressParamsValue}; | ||
22 | use rust_analyzer::{main_loop, req, ServerConfig}; | 23 | use rust_analyzer::{main_loop, req, ServerConfig}; |
23 | 24 | ||
24 | pub struct Project<'a> { | 25 | pub struct Project<'a> { |
@@ -201,10 +202,14 @@ impl Server { | |||
201 | } | 202 | } |
202 | pub fn wait_until_workspace_is_loaded(&self) { | 203 | pub fn wait_until_workspace_is_loaded(&self) { |
203 | self.wait_for_message_cond(1, &|msg: &Message| match msg { | 204 | self.wait_for_message_cond(1, &|msg: &Message| match msg { |
204 | Message::Notification(n) if n.method == "window/showMessage" => { | 205 | Message::Notification(n) if n.method == "$/progress" => { |
205 | let msg = | 206 | match n.clone().extract::<ProgressParams>("$/progress").unwrap() { |
206 | n.clone().extract::<req::ShowMessageParams>("window/showMessage").unwrap(); | 207 | ProgressParams { |
207 | msg.message.starts_with("workspace loaded") | 208 | token: req::ProgressToken::String(ref token), |
209 | value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)), | ||
210 | } if token == "rustAnalyzer/startup" => true, | ||
211 | _ => false, | ||
212 | } | ||
208 | } | 213 | } |
209 | _ => false, | 214 | _ => false, |
210 | }) | 215 | }) |