diff --git a/src/actions/mod.rs b/src/actions/mod.rs index b2599e5b2e8..512ea3e8e3d 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -277,7 +277,7 @@ impl InitActionContext { self.jobs.lock().unwrap().add(job); } - pub fn wait_for_background_jobs(&self) { + pub fn wait_for_concurrent_jobs(&self) { self.jobs.lock().unwrap().wait_for_all(); } diff --git a/src/server/mod.rs b/src/server/mod.rs index f389d0dd65d..46fdfe5baac 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -35,7 +35,6 @@ pub use server::message::{ Ack, BlockingNotificationAction, BlockingRequestAction, NoResponse, Notification, Request, Response, ResponseError, RequestId }; -use concurrency::Jobs; use std::path::PathBuf; use std::sync::atomic::Ordering; use std::sync::{Arc, Mutex}; @@ -196,7 +195,7 @@ impl LsService { let request: Request<$br_action> = msg.parse_as_request()?; // block until all nonblocking requests have been handled ensuring ordering - self.wait_for_background_jobs(); + self.wait_for_concurrent_jobs(); let req_id = request.id.clone(); match request.blocking_dispatch(&mut self.ctx, &self.output) { @@ -337,10 +336,10 @@ impl LsService { ServerStateChange::Continue } - pub fn wait_for_background_jobs(&mut self) { + pub fn wait_for_concurrent_jobs(&mut self) { match &self.ctx { ActionContext::Init(ctx) => { - ctx.wait_for_background_jobs() + ctx.wait_for_concurrent_jobs() } ActionContext::Uninit(_) => {} } diff --git a/src/test/harness.rs b/src/test/harness.rs index 0a778918206..5b76f95de35 100644 --- a/src/test/harness.rs +++ b/src/test/harness.rs @@ -197,12 +197,12 @@ impl ExpectedMessage { } pub fn clear_messages(server: &mut ls_server::LsService, results: LsResultList) { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); results.lock().unwrap().clear(); } pub fn expect_messages(server: &mut ls_server::LsService, results: LsResultList, expected: &[&ExpectedMessage]) { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let mut results = results.lock().unwrap(); diff --git a/src/test/lens.rs b/src/test/lens.rs index 0ef47b788af..66e8581c4e0 100644 --- a/src/test/lens.rs +++ b/src/test/lens.rs @@ -67,7 +67,7 @@ fn test_lens_run() { ls_server::LsService::handle_message(&mut server), ls_server::ServerStateChange::Continue ); - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let result: serde_json::Value = serde_json::from_str(&results.lock().unwrap().remove(0)).unwrap(); compare_json( result.get("result").unwrap(), diff --git a/src/test/mod.rs b/src/test/mod.rs index c29f2a2a0f3..de189ca3d3b 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -1472,7 +1472,7 @@ fn test_deglob() { ls_server::ServerStateChange::Continue ); { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let response = json::parse(&results.lock().unwrap().remove(0)).unwrap(); assert_eq!(response["id"], 100); assert_eq!(response["result"][0]["title"], "Deglob import"); @@ -1505,7 +1505,7 @@ fn test_deglob() { ls_server::ServerStateChange::Continue ); { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let response = json::parse(&results.lock().unwrap().remove(0)).unwrap(); assert_eq!(response["id"], 0x0100_0001); assert_eq!(response["method"], "workspace/applyEdit"); @@ -1557,7 +1557,7 @@ fn test_deglob() { ); { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let response = json::parse(&results.lock().unwrap().remove(0)).unwrap(); assert_eq!(response["id"], 0x0100_0002); assert_eq!(response["method"], "workspace/applyEdit"); @@ -1719,7 +1719,7 @@ fn fail_uninitialized_request() { ls_server::ServerStateChange::Continue ); { - server.wait_for_background_jobs(); + server.wait_for_concurrent_jobs(); let response = json::parse(&results.lock().unwrap().remove(0)).unwrap(); assert_eq!(response["id"], 0); assert_eq!(response["error"]["code"], -32002);