Merge remote-tracking branch 'origin/main' into chat-again

This commit is contained in:
Nathan Sobo 2023-09-11 12:08:01 -06:00
commit fe6f0a253b
164 changed files with 7012 additions and 3586 deletions

View file

@ -744,7 +744,7 @@ mod tests {
use theme::{ThemeRegistry, ThemeSettings};
use workspace::{
item::{Item, ItemHandle},
open_new, open_paths, pane, NewFile, SplitDirection, WorkspaceHandle,
open_new, open_paths, pane, NewFile, SaveBehavior, SplitDirection, WorkspaceHandle,
};
#[gpui::test]
@ -1506,7 +1506,12 @@ mod tests {
pane2_item.downcast::<Editor>().unwrap().downgrade()
});
cx.dispatch_action(window.into(), workspace::CloseActiveItem);
cx.dispatch_action(
window.into(),
workspace::CloseActiveItem {
save_behavior: None,
},
);
cx.foreground().run_until_parked();
workspace.read_with(cx, |workspace, _| {
@ -1514,7 +1519,12 @@ mod tests {
assert_eq!(workspace.active_pane(), &pane_1);
});
cx.dispatch_action(window.into(), workspace::CloseActiveItem);
cx.dispatch_action(
window.into(),
workspace::CloseActiveItem {
save_behavior: None,
},
);
cx.foreground().run_until_parked();
window.simulate_prompt_answer(1, cx);
cx.foreground().run_until_parked();
@ -1672,7 +1682,7 @@ mod tests {
pane.update(cx, |pane, cx| {
let editor3_id = editor3.id();
drop(editor3);
pane.close_item_by_id(editor3_id, cx)
pane.close_item_by_id(editor3_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
@ -1707,7 +1717,7 @@ mod tests {
pane.update(cx, |pane, cx| {
let editor2_id = editor2.id();
drop(editor2);
pane.close_item_by_id(editor2_id, cx)
pane.close_item_by_id(editor2_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
@ -1863,24 +1873,32 @@ mod tests {
assert_eq!(active_path(&workspace, cx), Some(file4.clone()));
// Close all the pane items in some arbitrary order.
pane.update(cx, |pane, cx| pane.close_item_by_id(file1_item_id, cx))
.await
.unwrap();
pane.update(cx, |pane, cx| {
pane.close_item_by_id(file1_item_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
assert_eq!(active_path(&workspace, cx), Some(file4.clone()));
pane.update(cx, |pane, cx| pane.close_item_by_id(file4_item_id, cx))
.await
.unwrap();
pane.update(cx, |pane, cx| {
pane.close_item_by_id(file4_item_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
assert_eq!(active_path(&workspace, cx), Some(file3.clone()));
pane.update(cx, |pane, cx| pane.close_item_by_id(file2_item_id, cx))
.await
.unwrap();
pane.update(cx, |pane, cx| {
pane.close_item_by_id(file2_item_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
assert_eq!(active_path(&workspace, cx), Some(file3.clone()));
pane.update(cx, |pane, cx| pane.close_item_by_id(file3_item_id, cx))
.await
.unwrap();
pane.update(cx, |pane, cx| {
pane.close_item_by_id(file3_item_id, SaveBehavior::PromptOnWrite, cx)
})
.await
.unwrap();
assert_eq!(active_path(&workspace, cx), None);
// Reopen all the closed items, ensuring they are reopened in the same order