diff options
-rw-r--r-- | crates/rust-analyzer/tests/rust-analyzer/support.rs | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/crates/rust-analyzer/tests/rust-analyzer/support.rs b/crates/rust-analyzer/tests/rust-analyzer/support.rs index 4c4b994fe..453ce4fa8 100644 --- a/crates/rust-analyzer/tests/rust-analyzer/support.rs +++ b/crates/rust-analyzer/tests/rust-analyzer/support.rs | |||
@@ -8,14 +8,11 @@ use std::{ | |||
8 | 8 | ||
9 | use crossbeam_channel::{after, select, Receiver}; | 9 | use crossbeam_channel::{after, select, Receiver}; |
10 | use lsp_server::{Connection, Message, Notification, Request}; | 10 | use lsp_server::{Connection, Message, Notification, Request}; |
11 | use lsp_types::{ | 11 | use lsp_types::{notification::Exit, request::Shutdown, TextDocumentIdentifier, Url}; |
12 | notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, | ||
13 | }; | ||
14 | use lsp_types::{ProgressParams, ProgressParamsValue}; | ||
15 | use project_model::ProjectManifest; | 12 | use project_model::ProjectManifest; |
16 | use rust_analyzer::{config::Config, main_loop}; | 13 | use rust_analyzer::{config::Config, lsp_ext, main_loop}; |
17 | use serde::Serialize; | 14 | use serde::Serialize; |
18 | use serde_json::{to_string_pretty, Value}; | 15 | use serde_json::{json, to_string_pretty, Value}; |
19 | use test_utils::{find_mismatch, Fixture}; | 16 | use test_utils::{find_mismatch, Fixture}; |
20 | use vfs::AbsPathBuf; | 17 | use vfs::AbsPathBuf; |
21 | 18 | ||
@@ -106,9 +103,12 @@ impl<'a> Project<'a> { | |||
106 | ..Default::default() | 103 | ..Default::default() |
107 | }), | 104 | }), |
108 | window: Some(lsp_types::WindowClientCapabilities { | 105 | window: Some(lsp_types::WindowClientCapabilities { |
109 | work_done_progress: Some(true), | 106 | work_done_progress: Some(false), |
110 | ..Default::default() | 107 | ..Default::default() |
111 | }), | 108 | }), |
109 | experimental: Some(json!({ | ||
110 | "statusNotification": true, | ||
111 | })), | ||
112 | ..Default::default() | 112 | ..Default::default() |
113 | }, | 113 | }, |
114 | ); | 114 | ); |
@@ -192,9 +192,6 @@ impl Server { | |||
192 | while let Some(msg) = self.recv().unwrap_or_else(|Timeout| panic!("timeout: {:?}", r)) { | 192 | while let Some(msg) = self.recv().unwrap_or_else(|Timeout| panic!("timeout: {:?}", r)) { |
193 | match msg { | 193 | match msg { |
194 | Message::Request(req) => { | 194 | Message::Request(req) => { |
195 | if req.method == "window/workDoneProgress/create" { | ||
196 | continue; | ||
197 | } | ||
198 | if req.method == "client/registerCapability" { | 195 | if req.method == "client/registerCapability" { |
199 | let params = req.params.to_string(); | 196 | let params = req.params.to_string(); |
200 | if ["workspace/didChangeWatchedFiles", "textDocument/didSave"] | 197 | if ["workspace/didChangeWatchedFiles", "textDocument/didSave"] |
@@ -220,14 +217,13 @@ impl Server { | |||
220 | } | 217 | } |
221 | pub(crate) fn wait_until_workspace_is_loaded(self) -> Server { | 218 | pub(crate) fn wait_until_workspace_is_loaded(self) -> Server { |
222 | self.wait_for_message_cond(1, &|msg: &Message| match msg { | 219 | self.wait_for_message_cond(1, &|msg: &Message| match msg { |
223 | Message::Notification(n) if n.method == "$/progress" => { | 220 | Message::Notification(n) if n.method == "rust-analyzer/status" => { |
224 | match n.clone().extract::<ProgressParams>("$/progress").unwrap() { | 221 | let status = n |
225 | ProgressParams { | 222 | .clone() |
226 | token: lsp_types::ProgressToken::String(ref token), | 223 | .extract::<lsp_ext::StatusParams>("rust-analyzer/status") |
227 | value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)), | 224 | .unwrap() |
228 | } if token == "rustAnalyzer/roots scanned" => true, | 225 | .status; |
229 | _ => false, | 226 | matches!(status, lsp_ext::Status::Ready) |
230 | } | ||
231 | } | 227 | } |
232 | _ => false, | 228 | _ => false, |
233 | }) | 229 | }) |