aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/support.rs32
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
9use crossbeam_channel::{after, select, Receiver}; 9use crossbeam_channel::{after, select, Receiver};
10use lsp_server::{Connection, Message, Notification, Request}; 10use lsp_server::{Connection, Message, Notification, Request};
11use lsp_types::{ 11use lsp_types::{notification::Exit, request::Shutdown, TextDocumentIdentifier, Url};
12 notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress,
13};
14use lsp_types::{ProgressParams, ProgressParamsValue};
15use project_model::ProjectManifest; 12use project_model::ProjectManifest;
16use rust_analyzer::{config::Config, main_loop}; 13use rust_analyzer::{config::Config, lsp_ext, main_loop};
17use serde::Serialize; 14use serde::Serialize;
18use serde_json::{to_string_pretty, Value}; 15use serde_json::{json, to_string_pretty, Value};
19use test_utils::{find_mismatch, Fixture}; 16use test_utils::{find_mismatch, Fixture};
20use vfs::AbsPathBuf; 17use 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 })