Report running language servers when sharing project for the first time
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
e9d19457d6
commit
69aa3d848e
2 changed files with 39 additions and 5 deletions
|
@ -2992,9 +2992,6 @@ async fn test_language_server_statuses(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let fake_language_server = fake_language_servers.next().await.unwrap();
|
let fake_language_server = fake_language_servers.next().await.unwrap();
|
||||||
|
|
||||||
let project_b = client_b.build_remote_project(&project_a, cx_a, cx_b).await;
|
|
||||||
|
|
||||||
fake_language_server.notify::<lsp::notification::Progress>(lsp::ProgressParams {
|
fake_language_server.notify::<lsp::notification::Progress>(lsp::ProgressParams {
|
||||||
token: lsp::NumberOrString::String("the-token".to_string()),
|
token: lsp::NumberOrString::String("the-token".to_string()),
|
||||||
value: lsp::ProgressParamsValue::WorkDone(lsp::WorkDoneProgress::Report(
|
value: lsp::ProgressParamsValue::WorkDone(lsp::WorkDoneProgress::Report(
|
||||||
|
@ -3004,7 +3001,6 @@ async fn test_language_server_statuses(
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
});
|
});
|
||||||
|
|
||||||
deterministic.run_until_parked();
|
deterministic.run_until_parked();
|
||||||
project_a.read_with(cx_a, |project, _| {
|
project_a.read_with(cx_a, |project, _| {
|
||||||
let status = project.language_server_statuses().next().unwrap();
|
let status = project.language_server_statuses().next().unwrap();
|
||||||
|
@ -3015,13 +3011,39 @@ async fn test_language_server_statuses(
|
||||||
"the-message"
|
"the-message"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let project_b = client_b.build_remote_project(&project_a, cx_a, cx_b).await;
|
||||||
|
project_b.read_with(cx_b, |project, _| {
|
||||||
|
let status = project.language_server_statuses().next().unwrap();
|
||||||
|
assert_eq!(status.name, "the-language-server");
|
||||||
|
});
|
||||||
|
|
||||||
|
fake_language_server.notify::<lsp::notification::Progress>(lsp::ProgressParams {
|
||||||
|
token: lsp::NumberOrString::String("the-token".to_string()),
|
||||||
|
value: lsp::ProgressParamsValue::WorkDone(lsp::WorkDoneProgress::Report(
|
||||||
|
lsp::WorkDoneProgressReport {
|
||||||
|
message: Some("the-message-2".to_string()),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
});
|
||||||
|
deterministic.run_until_parked();
|
||||||
|
project_a.read_with(cx_a, |project, _| {
|
||||||
|
let status = project.language_server_statuses().next().unwrap();
|
||||||
|
assert_eq!(status.name, "the-language-server");
|
||||||
|
assert_eq!(status.pending_work.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
status.pending_work["the-token"].message.as_ref().unwrap(),
|
||||||
|
"the-message-2"
|
||||||
|
);
|
||||||
|
});
|
||||||
project_b.read_with(cx_b, |project, _| {
|
project_b.read_with(cx_b, |project, _| {
|
||||||
let status = project.language_server_statuses().next().unwrap();
|
let status = project.language_server_statuses().next().unwrap();
|
||||||
assert_eq!(status.name, "the-language-server");
|
assert_eq!(status.name, "the-language-server");
|
||||||
assert_eq!(status.pending_work.len(), 1);
|
assert_eq!(status.pending_work.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
status.pending_work["the-token"].message.as_ref().unwrap(),
|
status.pending_work["the-token"].message.as_ref().unwrap(),
|
||||||
"the-message"
|
"the-message-2"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1256,6 +1256,18 @@ impl Project {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (server_id, status) in &self.language_server_statuses {
|
||||||
|
self.client
|
||||||
|
.send(proto::StartLanguageServer {
|
||||||
|
project_id,
|
||||||
|
server: Some(proto::LanguageServer {
|
||||||
|
id: *server_id as u64,
|
||||||
|
name: status.name.clone(),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.log_err();
|
||||||
|
}
|
||||||
|
|
||||||
cx.spawn(|this, mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
for task in tasks {
|
for task in tasks {
|
||||||
task.await?;
|
task.await?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue