Add searchable global tab switcher (#28047)
resolves #24655 resolves #23945 I haven't yet added a default binding for the new command. #27797 added `:ls` and `:buffers` which in my opinion should use the global searchable version given that that matches the vim semantics of those commands better than just showing the tabs in the local pane. There's also a question of what to do when you select a tab from another pane, should the focus jump to that pane or should that tab move to the currently focused pane? For now I've implemented the former. Release Notes: - Added `tab_switcher::ToggleAll` to search open tabs from all panes and focus the selected one. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
52eef3c35d
commit
4dff47ae20
40 changed files with 360 additions and 181 deletions
|
@ -1517,10 +1517,7 @@ async fn test_following_across_workspaces(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
workspace.leader_for_pane(workspace.active_pane())
|
||||
);
|
||||
let item = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(
|
||||
item.tab_description(0, cx).unwrap(),
|
||||
SharedString::from("w.rs")
|
||||
);
|
||||
assert_eq!(item.tab_content_text(0, cx), SharedString::from("w.rs"));
|
||||
});
|
||||
|
||||
// TODO: in app code, this would be done by the collab_ui.
|
||||
|
@ -1546,10 +1543,7 @@ async fn test_following_across_workspaces(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
executor.run_until_parked();
|
||||
workspace_b_project_a.update(&mut cx_b2, |workspace, cx| {
|
||||
let item = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(
|
||||
item.tab_description(0, cx).unwrap(),
|
||||
SharedString::from("x.rs")
|
||||
);
|
||||
assert_eq!(item.tab_content_text(0, cx), SharedString::from("x.rs"));
|
||||
});
|
||||
|
||||
workspace_a.update_in(cx_a, |workspace, window, cx| {
|
||||
|
@ -1564,7 +1558,7 @@ async fn test_following_across_workspaces(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
workspace.leader_for_pane(workspace.active_pane())
|
||||
);
|
||||
let item = workspace.active_pane().read(cx).active_item().unwrap();
|
||||
assert_eq!(item.tab_description(0, cx).unwrap(), "x.rs");
|
||||
assert_eq!(item.tab_content_text(0, cx), "x.rs");
|
||||
});
|
||||
|
||||
// b moves to y.rs in b's project, a is still following but can't yet see
|
||||
|
@ -1625,10 +1619,7 @@ async fn test_following_across_workspaces(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
workspace.leader_for_pane(workspace.active_pane())
|
||||
);
|
||||
let item = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(
|
||||
item.tab_description(0, cx).unwrap(),
|
||||
SharedString::from("y.rs")
|
||||
);
|
||||
assert_eq!(item.tab_content_text(0, cx), SharedString::from("y.rs"));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1885,13 +1876,7 @@ fn pane_summaries(workspace: &Entity<Workspace>, cx: &mut VisualTestContext) ->
|
|||
items: pane
|
||||
.items()
|
||||
.enumerate()
|
||||
.map(|(ix, item)| {
|
||||
(
|
||||
ix == active_ix,
|
||||
item.tab_description(0, cx)
|
||||
.map_or(String::new(), |s| s.to_string()),
|
||||
)
|
||||
})
|
||||
.map(|(ix, item)| (ix == active_ix, item.tab_content_text(0, cx).into()))
|
||||
.collect(),
|
||||
}
|
||||
})
|
||||
|
@ -2179,7 +2164,7 @@ async fn test_following_to_channel_notes_other_workspace(
|
|||
cx_a.run_until_parked();
|
||||
workspace_a.update(cx_a, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// b joins channel and is following a
|
||||
|
@ -2188,7 +2173,7 @@ async fn test_following_to_channel_notes_other_workspace(
|
|||
let (workspace_b, cx_b) = client_b.active_workspace(cx_b);
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// a opens a second workspace and the channel notes
|
||||
|
@ -2212,13 +2197,13 @@ async fn test_following_to_channel_notes_other_workspace(
|
|||
|
||||
workspace_a.update(cx_a, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// b should follow a back
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
let editor = workspace.active_item_as::<Editor>(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2238,7 +2223,7 @@ async fn test_following_while_deactivated(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
cx_a.run_until_parked();
|
||||
workspace_a.update(cx_a, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// b joins channel and is following a
|
||||
|
@ -2247,7 +2232,7 @@ async fn test_following_while_deactivated(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
let (workspace_b, cx_b) = client_b.active_workspace(cx_b);
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// stop following
|
||||
|
@ -2260,7 +2245,7 @@ async fn test_following_while_deactivated(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
let editor = workspace.active_item_as::<Editor>(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "1.txt");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "1.txt");
|
||||
});
|
||||
|
||||
// a opens a file in a new window
|
||||
|
@ -2281,12 +2266,12 @@ async fn test_following_while_deactivated(cx_a: &mut TestAppContext, cx_b: &mut
|
|||
|
||||
workspace_a.update(cx_a, |workspace, cx| {
|
||||
let editor = workspace.active_item(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "2.js");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "2.js");
|
||||
});
|
||||
|
||||
// b should follow a back
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
let editor = workspace.active_item_as::<Editor>(cx).unwrap();
|
||||
assert_eq!(editor.tab_description(0, cx).unwrap(), "2.js");
|
||||
assert_eq!(editor.tab_content_text(0, cx), "2.js");
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue