Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Align naming
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Jul 16, 2018
1 parent 0eb2238 commit dd1f805
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
7 changes: 3 additions & 4 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -196,7 +195,7 @@ impl<O: Output> LsService<O> {
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) {
Expand Down Expand Up @@ -337,10 +336,10 @@ impl<O: Output> LsService<O> {
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(_) => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ impl ExpectedMessage {
}

pub fn clear_messages(server: &mut ls_server::LsService<RecordOutput>, 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<RecordOutput>, results: LsResultList, expected: &[&ExpectedMessage]) {
server.wait_for_background_jobs();
server.wait_for_concurrent_jobs();

let mut results = results.lock().unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/test/lens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
8 changes: 4 additions & 4 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dd1f805

Please sign in to comment.