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:
Julia Ryan 2025-04-28 02:21:27 -07:00 committed by GitHub
parent 52eef3c35d
commit 4dff47ae20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 360 additions and 181 deletions

View file

@ -731,17 +731,21 @@ impl Item for NotebookEditor {
}
fn tab_content(&self, params: TabContentParams, window: &Window, cx: &App) -> AnyElement {
Label::new(self.tab_content_text(params.detail.unwrap_or(0), cx))
.single_line()
.color(params.text_color())
.when(params.preview, |this| this.italic())
.into_any_element()
}
fn tab_content_text(&self, _detail: usize, cx: &App) -> SharedString {
let path = &self.notebook_item.read(cx).path;
let title = path
.file_name()
.unwrap_or_else(|| path.as_os_str())
.to_string_lossy()
.to_string();
Label::new(title)
.single_line()
.color(params.text_color())
.when(params.preview, |this| this.italic())
.into_any_element()
title.into()
}
fn tab_icon(&self, _window: &Window, _cx: &App) -> Option<Icon> {

View file

@ -178,8 +178,8 @@ impl Focusable for ReplSessionsPage {
impl Item for ReplSessionsPage {
type Event = ItemEvent;
fn tab_content_text(&self, _window: &Window, _cx: &App) -> Option<SharedString> {
Some("REPL Sessions".into())
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
"REPL Sessions".into()
}
fn telemetry_event_text(&self) -> Option<&'static str> {