Fix tab switcher spacing bug (#41329)

Anthony Eid created

The tab switcher render matches calls each workspace item's
`Item::tab_content` function that can return an element of variable
size. Because the tab switcher was using a uniform list under the hood,
this would cause spacing issues when tab_contents elements had different
sizes.

The fix is by changing the picker to use a material list under the hood.

Release Notes:

- N/A

Change summary

crates/picker/src/picker.rs             | 9 +++++++++
crates/tab_switcher/src/tab_switcher.rs | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)

Detailed changes

crates/picker/src/picker.rs 🔗

@@ -275,6 +275,15 @@ impl<D: PickerDelegate> Picker<D> {
         Self::new(delegate, ContainerKind::UniformList, head, window, cx)
     }
 
+    /// A picker, which displays its matches using `gpui::list`, matches can have different heights.
+    /// The picker allows the user to perform search items by text.
+    /// If `PickerDelegate::render_match` only returns items with the same height, use `Picker::uniform_list` as its implementation is optimized for that.
+    pub fn nonsearchable_list(delegate: D, window: &mut Window, cx: &mut Context<Self>) -> Self {
+        let head = Head::empty(Self::on_empty_head_blur, window, cx);
+
+        Self::new(delegate, ContainerKind::List, head, window, cx)
+    }
+
     /// A picker, which displays its matches using `gpui::list`, matches can have different heights.
     /// The picker allows the user to perform search items by text.
     /// If `PickerDelegate::render_match` only returns items with the same height, use `Picker::uniform_list` as its implementation is optimized for that.

crates/tab_switcher/src/tab_switcher.rs 🔗

@@ -155,9 +155,9 @@ impl TabSwitcher {
         Self {
             picker: cx.new(|cx| {
                 if is_global {
-                    Picker::uniform_list(delegate, window, cx)
+                    Picker::list(delegate, window, cx)
                 } else {
-                    Picker::nonsearchable_uniform_list(delegate, window, cx)
+                    Picker::nonsearchable_list(delegate, window, cx)
                 }
             }),
             init_modifiers,