tasks: Refresh available tasks in editor when tasks.json changes (#11811)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-05-14 21:26:35 +02:00 committed by GitHub
parent 0ae0b08c38
commit 1db136ff65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 126 additions and 50 deletions

View file

@ -242,19 +242,25 @@ async fn test_managing_project_specific_settings(cx: &mut gpui::TestAppContext)
}]))
.unwrap();
let (tx, rx) = futures::channel::mpsc::unbounded();
let templates = cx.update(|cx| TrackedFile::new(rx, cx));
cx.update(|cx| {
project.update(cx, |project, cx| {
project.task_inventory().update(cx, |inventory, cx| {
inventory.remove_local_static_source(Path::new("/the-root/.zed/tasks.json"));
inventory.add_source(
global_task_source_kind.clone(),
|tx, cx| StaticSource::new(TrackedFile::new(rx, tx, cx)),
cx,
);
});
})
});
tx.unbounded_send(tasks).unwrap();
let source = StaticSource::new(templates);
cx.run_until_parked();
cx.update(|cx| {
let all_tasks = project
.update(cx, |project, cx| {
project.task_inventory().update(cx, |inventory, cx| {
inventory.remove_local_static_source(Path::new("/the-root/.zed/tasks.json"));
inventory.add_source(global_task_source_kind.clone(), source, cx);
project.task_inventory().update(cx, |inventory, _| {
let (mut old, new) = inventory.used_and_current_resolved_tasks(
None,
Some(workree_id),