From a041e07c995a2828b5834d852cb83e9e0b10b7ce Mon Sep 17 00:00:00 2001 From: Aleksei Trifonov Date: Sun, 18 Feb 2024 09:14:08 +0300 Subject: [PATCH] Hide Inline Assist button if assistant.button is disabled (#7932) This PR adds check for `assistant.button` setting in quick bar, to hide it when the setting is set to false. It seems that the setting can be a separate one, I would be happy to add it if needed. Release Notes: - Improved `assistant.button` setting so that `Inline Assist` button in editor quick bar is also hidden ([#4500](https://github.com/zed-industries/zed/issues/4500)). --- crates/assistant/src/assistant.rs | 2 +- crates/quick_action_bar/src/quick_action_bar.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/assistant/src/assistant.rs b/crates/assistant/src/assistant.rs index d262ffd57df2329ea26efd8b176978f221e1a0ab..ae01db5adea194bc6ee772824f93fb071ded0760 100644 --- a/crates/assistant/src/assistant.rs +++ b/crates/assistant/src/assistant.rs @@ -1,5 +1,5 @@ pub mod assistant_panel; -mod assistant_settings; +pub mod assistant_settings; mod codegen; mod prompts; mod streaming_diff; diff --git a/crates/quick_action_bar/src/quick_action_bar.rs b/crates/quick_action_bar/src/quick_action_bar.rs index b7c783b344b17c0342aad03a5a4211e8c8caec56..75d35fd4f8c922853636154f7a1fe8d19b8b68ea 100644 --- a/crates/quick_action_bar/src/quick_action_bar.rs +++ b/crates/quick_action_bar/src/quick_action_bar.rs @@ -1,3 +1,4 @@ +use assistant::assistant_settings::AssistantSettings; use assistant::{AssistantPanel, InlineAssist}; use editor::{Editor, EditorSettings}; @@ -126,7 +127,9 @@ impl Render for QuickActionBar { .gap_2() .children(inlay_hints_button) .children(search_button) - .child(assistant_button) + .when(AssistantSettings::get_global(cx).button, |bar| { + bar.child(assistant_button) + }) } }