From e60f0295257d8c6611c05f95c6e4d3b7b7ef381c Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 15 May 2025 06:30:45 -0300 Subject: [PATCH] agent: Add adjustments to settings view (#30743) - Make provider blocks collapsed by default - Fix sections growing unnecessarily when there's available space Release Notes: - N/A --- crates/agent/src/agent_configuration.rs | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/crates/agent/src/agent_configuration.rs b/crates/agent/src/agent_configuration.rs index ec3e2ac44cf5163cbacf2c662f4baab672d43283..9bc8ad43c0de761dab2a3669c1d160c11e2a02bc 100644 --- a/crates/agent/src/agent_configuration.rs +++ b/crates/agent/src/agent_configuration.rs @@ -18,8 +18,8 @@ use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageMod use project::context_server_store::{ContextServerStatus, ContextServerStore}; use settings::{Settings, update_settings_file}; use ui::{ - Disclosure, Divider, DividerColor, ElevationIndex, Indicator, Scrollbar, ScrollbarState, - Switch, SwitchColor, Tooltip, prelude::*, + Disclosure, ElevationIndex, Indicator, Scrollbar, ScrollbarState, Switch, SwitchColor, Tooltip, + prelude::*, }; use util::ResultExt as _; use zed_actions::ExtensionCategoryFilter; @@ -142,7 +142,7 @@ impl AgentConfiguration { .expanded_provider_configurations .get(&provider.id()) .copied() - .unwrap_or(true); + .unwrap_or(false); v_flex() .pt_3() @@ -201,12 +201,12 @@ impl AgentConfiguration { .on_click(cx.listener({ let provider_id = provider.id().clone(); move |this, _event, _window, _cx| { - let is_open = this + let is_expanded = this .expanded_provider_configurations .entry(provider_id.clone()) - .or_insert(true); + .or_insert(false); - *is_open = !*is_open; + *is_expanded = !*is_expanded; } })), ), @@ -214,9 +214,9 @@ impl AgentConfiguration { ) .when(is_expanded, |parent| match configuration_view { Some(configuration_view) => parent.child(configuration_view), - None => parent.child(div().child(Label::new(format!( + None => parent.child(Label::new(format!( "No configuration view for {provider_name}", - )))), + ))), }) } @@ -230,7 +230,8 @@ impl AgentConfiguration { .p(DynamicSpacing::Base16.rems(cx)) .pr(DynamicSpacing::Base20.rems(cx)) .gap_4() - .flex_1() + .border_b_1() + .border_color(cx.theme().colors().border) .child( v_flex() .gap_0p5() @@ -331,7 +332,8 @@ impl AgentConfiguration { .p(DynamicSpacing::Base16.rems(cx)) .pr(DynamicSpacing::Base20.rems(cx)) .gap_2p5() - .flex_1() + .border_b_1() + .border_color(cx.theme().colors().border) .child(Headline::new("General Settings")) .child(self.render_command_permission(cx)) .child(self.render_single_file_review(cx)) @@ -344,18 +346,17 @@ impl AgentConfiguration { ) -> impl IntoElement { let context_server_ids = self.context_server_store.read(cx).all_server_ids().clone(); - const SUBHEADING: &str = "Connect to context servers via the Model Context Protocol either via Zed extensions or directly."; - v_flex() .p(DynamicSpacing::Base16.rems(cx)) .pr(DynamicSpacing::Base20.rems(cx)) .gap_2() - .flex_1() + .border_b_1() + .border_color(cx.theme().colors().border) .child( v_flex() .gap_0p5() .child(Headline::new("Model Context Protocol (MCP) Servers")) - .child(Label::new(SUBHEADING).color(Color::Muted)), + .child(Label::new("Connect to context servers via the Model Context Protocol either via Zed extensions or directly.").color(Color::Muted)), ) .children( context_server_ids.into_iter().map(|context_server_id| { @@ -630,9 +631,7 @@ impl Render for AgentConfiguration { .size_full() .overflow_y_scroll() .child(self.render_general_settings_section(cx)) - .child(Divider::horizontal().color(DividerColor::Border)) .child(self.render_context_servers_section(window, cx)) - .child(Divider::horizontal().color(DividerColor::Border)) .child(self.render_provider_configuration_section(cx)), ) .child(