Debugging

Richard Feldman created

Change summary

crates/agent_ui/src/acp/model_selector.rs           |  2 
crates/agent_ui/src/acp/model_selector_popover.rs   |  8 +++-
crates/agent_ui/src/agent_configuration.rs          | 10 ++++++
crates/agent_ui/src/language_model_selector.rs      | 14 ++++++--
crates/extension_host/src/wasm_host/llm_provider.rs |  8 ++++
crates/gpui/src/elements/svg.rs                     | 21 +++++++++++--
crates/language_model/src/registry.rs               |  4 +-
crates/language_models/src/extension.rs             |  6 +++
crates/ui/src/components/icon.rs                    | 23 +++++---------
9 files changed, 67 insertions(+), 29 deletions(-)

Detailed changes

crates/agent_ui/src/acp/model_selector.rs 🔗

@@ -294,7 +294,7 @@ impl PickerDelegate for AcpModelPickerDelegate {
                                         .gap_1p5()
                                         .map(|this| match &model_info.icon {
                                             Some(AgentModelIcon::Path(path)) => this.child(
-                                                Icon::from_path(path.clone())
+                                                Icon::from_external_svg(path.clone())
                                                     .color(model_icon_color)
                                                     .size(IconSize::Small),
                                             ),

crates/agent_ui/src/acp/model_selector_popover.rs 🔗

@@ -79,9 +79,11 @@ impl Render for AcpModelSelectorPopover {
             ButtonLike::new("active-model")
                 .selected_style(ButtonStyle::Tinted(TintColor::Accent))
                 .when_some(model_icon, |this, icon| match icon {
-                    AgentModelIcon::Path(path) => {
-                        this.child(Icon::from_path(path).color(color).size(IconSize::XSmall))
-                    }
+                    AgentModelIcon::Path(path) => this.child(
+                        Icon::from_external_svg(path)
+                            .color(color)
+                            .size(IconSize::XSmall),
+                    ),
                     AgentModelIcon::Named(icon_name) => {
                         this.child(Icon::new(icon_name).color(color).size(IconSize::XSmall))
                     }

crates/agent_ui/src/agent_configuration.rs 🔗

@@ -261,10 +261,20 @@ impl AgentConfiguration {
                                     .w_full()
                                     .gap_1p5()
                                     .child(if let Some(icon_path) = provider.icon_path() {
+                                        log::info!(
+                                            "Rendering LLM provider icon with from_external_svg: provider={}, path={}",
+                                            provider.id(),
+                                            icon_path
+                                        );
                                         Icon::from_external_svg(icon_path)
                                             .size(IconSize::Small)
                                             .color(Color::Muted)
                                     } else {
+                                        log::info!(
+                                            "Rendering LLM provider icon with Icon::new: provider={}, icon={:?}",
+                                            provider.id(),
+                                            provider.icon()
+                                        );
                                         Icon::new(provider.icon())
                                             .size(IconSize::Small)
                                             .color(Color::Muted)

crates/agent_ui/src/language_model_selector.rs 🔗

@@ -46,7 +46,9 @@ pub fn language_model_selector(
 }
 
 fn all_models(cx: &App) -> GroupedModels {
-    let providers = LanguageModelRegistry::global(cx).read(cx).providers();
+    let providers = LanguageModelRegistry::global(cx)
+        .read(cx)
+        .visible_providers();
 
     let recommended = providers
         .iter()
@@ -536,10 +538,14 @@ impl PickerDelegate for LanguageModelPickerDelegate {
                                 .w_full()
                                 .gap_1p5()
                                 .child(match &model_info.icon {
-                                    ProviderIcon::Name(icon_name) => Icon::new(*icon_name)
-                                        .color(model_icon_color)
-                                        .size(IconSize::Small),
+                                    ProviderIcon::Name(icon_name) => {
+                                        log::info!("ICON_DEBUG model_selector using Icon::new for {:?}", icon_name);
+                                        Icon::new(*icon_name)
+                                            .color(model_icon_color)
+                                            .size(IconSize::Small)
+                                    }
                                     ProviderIcon::Path(icon_path) => {
+                                        log::info!("ICON_DEBUG model_selector using from_external_svg path={}", icon_path);
                                         Icon::from_external_svg(icon_path.clone())
                                             .color(model_icon_color)
                                             .size(IconSize::Small)

crates/extension_host/src/wasm_host/llm_provider.rs 🔗

@@ -123,7 +123,13 @@ impl LanguageModelProvider for ExtensionLanguageModelProvider {
     }
 
     fn icon_path(&self) -> Option<SharedString> {
-        self.icon_path.clone()
+        let path = self.icon_path.clone();
+        log::info!(
+            "LLM provider {} icon_path() returning: {:?}",
+            self.provider_info.id,
+            path
+        );
+        path
     }
 
     fn default_model(&self, cx: &App) -> Option<Arc<dyn LanguageModel>> {

crates/gpui/src/elements/svg.rs 🔗

@@ -132,12 +132,25 @@ impl Element for Svg {
                 } else if let Some((path, color)) =
                     self.external_path.as_ref().zip(style.text.color)
                 {
-                    let Some(bytes) = window
-                        .use_asset::<SvgAsset>(path, cx)
-                        .and_then(|asset| asset.log_err())
-                    else {
+                    log::info!(
+                        "ICON_DEBUG svg.rs external_path={}, color={:?}",
+                        path,
+                        color
+                    );
+                    let Some(bytes) = window.use_asset::<SvgAsset>(path, cx).and_then(|asset| {
+                        if let Err(ref e) = asset {
+                            log::error!("ICON_DEBUG svg.rs FAILED path={}: {:?}", path, e);
+                        }
+                        asset.log_err()
+                    }) else {
+                        log::warn!("ICON_DEBUG svg.rs NO_BYTES path={}", path);
                         return;
                     };
+                    log::info!(
+                        "ICON_DEBUG svg.rs loaded {} bytes path={}",
+                        bytes.len(),
+                        path
+                    );
 
                     let transformation = self
                         .transformation

crates/language_model/src/registry.rs 🔗

@@ -203,14 +203,14 @@ impl LanguageModelRegistry {
     pub fn visible_providers(&self) -> Vec<Arc<dyn LanguageModelProvider>> {
         let all = self.providers();
         log::info!(
-            "LanguageModelRegistry::visible_providers called, all_providers={}, installed_llm_extension_ids={:?}",
+            "ICON_DEBUG visible_providers: all_providers={}, installed_llm_extension_ids={:?}",
             all.len(),
             self.installed_llm_extension_ids
         );
         for p in &all {
             let hidden = self.should_hide_provider(&p.id());
             log::info!(
-                "  provider {} (id: {}): hidden={}",
+                "ICON_DEBUG   provider {} (id: {}): hidden={}",
                 p.name(),
                 p.id(),
                 hidden

crates/language_models/src/extension.rs 🔗

@@ -66,5 +66,11 @@ pub fn init_proxy(cx: &mut App) {
     log::info!(
         "language_models::extension::init_proxy: registering LanguageModelProviderRegistryProxy"
     );
+
+    // Set the function that determines which built-in providers should be hidden
+    registry.update(cx, |registry, _cx| {
+        registry.set_builtin_provider_hiding_fn(Box::new(extension_for_builtin_provider));
+    });
+
     proxy.register_language_model_provider_proxy(LanguageModelProviderRegistryProxy::new(registry));
 }

crates/ui/src/components/icon.rs 🔗

@@ -144,23 +144,18 @@ impl Icon {
         }
     }
 
-    /// Create an icon from an embedded SVG path (e.g., "icons/ai.svg").
-    /// These are SVGs bundled in the Zed binary.
-    pub fn from_embedded(path: impl Into<SharedString>) -> Self {
-        Self {
-            source: IconSource::Embedded(path.into()),
-            color: Color::default(),
-            size: IconSize::default().rems(),
-            transformation: Transformation::default(),
-        }
-    }
-
-    /// Create an icon from an external file path (e.g., from an extension).
-    /// This renders the file as a raster image.
+    /// Create an icon from a path. Uses a heuristic to determine if it's embedded or external:
+    /// - Paths starting with "icons/" are treated as embedded SVGs
+    /// - Other paths are treated as external raster images (from icon themes)
     pub fn from_path(path: impl Into<SharedString>) -> Self {
         let path = path.into();
+        let source = if path.starts_with("icons/") {
+            IconSource::Embedded(path)
+        } else {
+            IconSource::External(Arc::from(PathBuf::from(path.as_ref())))
+        };
         Self {
-            source: IconSource::External(Arc::from(PathBuf::from(path.as_ref()))),
+            source,
             color: Color::default(),
             size: IconSize::default().rems(),
             transformation: Transformation::default(),