workspace: Make Item::clone_on_split async (#41211)

Split out from https://github.com/zed-industries/zed/pull/40774 to
reduce the size of the reland of that PR (once I figure out the cause of
the issue)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-26 08:46:37 +00:00
committed by GitHub
parent b7cc597d28
commit 33ec545d1f
24 changed files with 217 additions and 157 deletions
+12 -5
View File
@@ -3292,11 +3292,18 @@ impl Pane {
else {
return;
};
if let Some(item) = item.clone_on_split(database_id, window, cx) {
to_pane.update(cx, |pane, cx| {
pane.add_item(item, true, true, None, window, cx);
})
}
let task = item.clone_on_split(database_id, window, cx);
let to_pane = to_pane.downgrade();
cx.spawn_in(window, async move |_, cx| {
if let Some(item) = task.await {
to_pane
.update_in(cx, |pane, window, cx| {
pane.add_item(item, true, true, None, window, cx)
})
.ok();
}
})
.detach();
} else {
move_item(&from_pane, &to_pane, item_id, ix, true, window, cx);
}