Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
acp: Fix model selector sometimes showing no models (#37006)
Bennet Bo Fennerb5e9b65e8ccc
diff --git a/crates/acp_thread/src/connection.rs b/crates/acp_thread/src/connection.rsindex e4ab4c6ec54..af229b75456 100644--- a/crates/acp_thread/src/connection.rs+++ b/crates/acp_thread/src/connection.rs@@ -232,13 +232,6 @@ impl AgentModelList {AgentModelList::Grouped(groups) => groups.is_empty(),}}-- pub fn len(&self) -> usize {- match self {- AgentModelList::Flat(models) => models.len(),- AgentModelList::Grouped(groups) => groups.values().len(),- }- }}#[cfg(feature = "test-support")]diff --git a/crates/agent_ui/src/acp/model_selector.rs b/crates/agent_ui/src/acp/model_selector.rsindex 052277d3e6e..cbb513696d8 100644--- a/crates/agent_ui/src/acp/model_selector.rs+++ b/crates/agent_ui/src/acp/model_selector.rs@@ -71,13 +71,10 @@ impl AcpModelPickerDelegate {let (models, selected_model) = futures::join!(models_task, selected_model_task);this.update_in(cx, |this, window, cx| {- this.delegate.models = models.log_err();+ this.delegate.models = models.ok();this.delegate.selected_model = selected_model.ok();- this.delegate.update_matches(this.query(cx), window, cx)- })?- .await;-- Ok(())+ this.refresh(window, cx)+ })}refresh(&this, &session_id, cx).await.log_err();@@ -144,11 +141,6 @@ impl PickerDelegate for AcpModelPickerDelegate {cx.spawn_in(window, async move |this, cx| {let filtered_models = match this.read_with(cx, |this, cx| {- if let Some(models) = this.delegate.models.as_ref() {- log::debug!("Filtering {} models.", models.len());- } else {- log::debug!("No models available.");- }this.delegate.models.clone().map(move |models| {fuzzy_search(models, query, cx.background_executor().clone())})@@ -160,8 +152,6 @@ impl PickerDelegate for AcpModelPickerDelegate {None => AgentModelList::Flat(vec![]),};- log::debug!("Filtered models. {} available.", filtered_models.len());-this.update_in(cx, |this, window, cx| {this.delegate.filtered_entries =info_list_to_picker_entries(filtered_models).collect();