Disable file watching when running slow tests

This should rid us of the intermittent test failure

https://github.com/rust-analyzer/rust-analyzer/pull/5017#issuecomment-648717983
This commit is contained in:
Aleksey Kladov 2020-06-24 12:27:13 +02:00
parent c544f9a137
commit a0b76161ab

View File

@ -19,7 +19,7 @@
use ra_project_model::ProjectManifest;
use rust_analyzer::{
config::{ClientCapsConfig, Config, LinkedProject},
config::{ClientCapsConfig, Config, FilesConfig, FilesWatcher, LinkedProject},
main_loop,
};
@ -90,9 +90,9 @@ pub fn server(self) -> Server {
},
with_sysroot: self.with_sysroot,
linked_projects,
files: FilesConfig { watcher: FilesWatcher::Client, exclude: Vec::new() },
..Config::default()
};
if let Some(f) = &self.config {
f(&mut config)
}
@ -173,8 +173,14 @@ fn send_request_(&self, r: Request) -> Value {
self.client.sender.send(r.into()).unwrap();
while let Some(msg) = self.recv() {
match msg {
Message::Request(req) if req.method == "window/workDoneProgress/create" => (),
Message::Request(req) => panic!("unexpected request: {:?}", req),
Message::Request(req) => {
if req.method != "window/workDoneProgress/create"
&& !(req.method == "client/registerCapability"
&& req.params.to_string().contains("workspace/didChangeWatchedFiles"))
{
panic!("unexpected request: {:?}", req)
}
}
Message::Notification(_) => (),
Message::Response(res) => {
assert_eq!(res.id, id);