From 6e37ff880f616f7128c09e567af22c4ee46c3cd7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 10 Mar 2023 17:02:52 +0100 Subject: [PATCH 1/7] Replace "Give Feedback" with an icon and move it to the left This is so we can show the current language in the status bar on the right, and having two pieces of text sitting next to each other felt too busy. Co-Authored-By: Nathan Sobo --- assets/icons/speech_bubble_12.svg | 3 +++ crates/feedback/src/deploy_feedback_button.rs | 20 ++++++++++++------- crates/theme/src/theme.rs | 2 +- crates/zed/src/zed.rs | 2 +- styles/src/styleTree/statusBar.ts | 8 ++++++-- 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 assets/icons/speech_bubble_12.svg diff --git a/assets/icons/speech_bubble_12.svg b/assets/icons/speech_bubble_12.svg new file mode 100644 index 0000000000000000000000000000000000000000..f5f330056a34f1261d31416b688bcc86dcdf8bf1 --- /dev/null +++ b/assets/icons/speech_bubble_12.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/feedback/src/deploy_feedback_button.rs b/crates/feedback/src/deploy_feedback_button.rs index 8fcafdfedee101458f0513d145d504831bfbdb34..7519d2d06e649164cdd742dca4d3dc92e51d7899 100644 --- a/crates/feedback/src/deploy_feedback_button.rs +++ b/crates/feedback/src/deploy_feedback_button.rs @@ -1,7 +1,4 @@ -use gpui::{ - elements::{MouseEventHandler, ParentElement, Stack, Text}, - CursorStyle, Element, ElementBox, Entity, MouseButton, RenderContext, View, ViewContext, -}; +use gpui::{elements::*, CursorStyle, Entity, MouseButton, RenderContext, View, ViewContext}; use settings::Settings; use workspace::{item::ItemHandle, StatusItemView}; @@ -23,9 +20,18 @@ impl View for DeployFeedbackButton { .with_child( MouseEventHandler::::new(0, cx, |state, cx| { let theme = &cx.global::().theme; - let theme = &theme.workspace.status_bar.feedback; - - Text::new("Give Feedback", theme.style_for(state, true).clone()).boxed() + let style = &theme.workspace.status_bar.feedback.style_for(state, false); + Svg::new("icons/speech_bubble_12.svg") + .with_color(style.color) + .constrained() + .with_width(style.icon_width) + .aligned() + .constrained() + .with_width(style.button_width) + .with_height(style.button_width) + .contained() + .with_style(style.container) + .boxed() }) .with_cursor_style(CursorStyle::PointingHand) .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback)) diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 484c542edeffce8b22c8f2f29ae4f672c0693399..56ef87e0af3e3ca6b955d75e9adf843ef6cff833 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -280,7 +280,7 @@ pub struct StatusBar { pub auto_update_progress_message: TextStyle, pub auto_update_done_message: TextStyle, pub lsp_status: Interactive, - pub feedback: Interactive, + pub feedback: Interactive, pub sidebar_buttons: StatusBarSidebarButtons, pub diagnostic_summary: Interactive, pub diagnostic_message: Interactive, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 79a6f67f621804b0f5d0193b62875c418c5c818d..f853e41c0429cddc1cb1c5fcee14dff429cfb3a9 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -342,10 +342,10 @@ pub fn initialize_workspace( let feedback_button = cx.add_view(|_| feedback::deploy_feedback_button::DeployFeedbackButton {}); workspace.status_bar().update(cx, |status_bar, cx| { + status_bar.add_left_item(feedback_button, cx); status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); status_bar.add_right_item(cursor_position, cx); - status_bar.add_right_item(feedback_button, cx); }); auto_update::notify_of_any_new_update(cx.weak_handle(), cx); diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/styleTree/statusBar.ts index a60a55df1ecaae3ce52edfc82c90222db30718cb..eb72346788a78b62be63600587eefc981676dc7d 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/styleTree/statusBar.ts @@ -45,8 +45,12 @@ export default function statusBar(colorScheme: ColorScheme) { hover: text(layer, "sans", "hovered"), }, feedback: { - ...text(layer, "sans", "variant"), - hover: text(layer, "sans", "hovered"), + color: foreground(layer, "variant"), + iconWidth: 14, + buttonWidth: 20, + hover: { + color: foreground(layer, "on"), + }, }, diagnosticSummary: { height: 20, From b3c7526fb5609e06cb3dad5771adf4de0389a929 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 10 Mar 2023 17:21:06 +0100 Subject: [PATCH 2/7] Return last excerpt in MultiBuffer::excerpt_containing if overshooting --- crates/editor/src/multi_buffer.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index da3c6bc4bd44ad76a01c407f41be7e6429a1bbd1..e1e82859317929404182b7766d34b143ff5c01dc 100644 --- a/crates/editor/src/multi_buffer.rs +++ b/crates/editor/src/multi_buffer.rs @@ -1082,18 +1082,21 @@ impl MultiBuffer { let mut cursor = snapshot.excerpts.cursor::(); cursor.seek(&position, Bias::Right, &()); - cursor.item().map(|excerpt| { - ( - excerpt.id.clone(), - self.buffers - .borrow() - .get(&excerpt.buffer_id) - .unwrap() - .buffer - .clone(), - excerpt.range.context.clone(), - ) - }) + cursor + .item() + .or_else(|| snapshot.excerpts.last()) + .map(|excerpt| { + ( + excerpt.id.clone(), + self.buffers + .borrow() + .get(&excerpt.buffer_id) + .unwrap() + .buffer + .clone(), + excerpt.range.context.clone(), + ) + }) } // If point is at the end of the buffer, the last excerpt is returned From 693172854c45bbb910973fb2dde941a0b3308944 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 10 Mar 2023 17:28:27 +0100 Subject: [PATCH 3/7] Show active buffer's language on the right in the status bar --- .../src/active_buffer_language.rs | 86 +++++++++++++++++++ .../src/language_selector.rs | 4 +- crates/theme/src/theme.rs | 1 + crates/zed/src/zed.rs | 2 + styles/src/styleTree/statusBar.ts | 9 +- 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 crates/language_selector/src/active_buffer_language.rs diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs new file mode 100644 index 0000000000000000000000000000000000000000..c4129d1448c1eee0712a5d43765b3d08ea2e4b23 --- /dev/null +++ b/crates/language_selector/src/active_buffer_language.rs @@ -0,0 +1,86 @@ +use editor::Editor; +use gpui::{ + elements::*, CursorStyle, Entity, MouseButton, RenderContext, Subscription, View, ViewContext, + ViewHandle, +}; +use settings::Settings; +use std::sync::Arc; +use workspace::{item::ItemHandle, StatusItemView}; + +pub struct ActiveBufferLanguage { + active_language: Option>, + _observe_active_editor: Option, +} + +impl Default for ActiveBufferLanguage { + fn default() -> Self { + Self::new() + } +} + +impl ActiveBufferLanguage { + pub fn new() -> Self { + Self { + active_language: None, + _observe_active_editor: None, + } + } + + fn update_language(&mut self, editor: ViewHandle, cx: &mut ViewContext) { + let editor = editor.read(cx); + self.active_language.take(); + if let Some((_, buffer, _)) = editor.active_excerpt(cx) { + if let Some(language) = buffer.read(cx).language() { + self.active_language = Some(language.name()); + } + } + + cx.notify(); + } +} + +impl Entity for ActiveBufferLanguage { + type Event = (); +} + +impl View for ActiveBufferLanguage { + fn ui_name() -> &'static str { + "ActiveBufferLanguage" + } + + fn render(&mut self, cx: &mut RenderContext) -> ElementBox { + if let Some(active_language) = self.active_language.as_ref() { + MouseEventHandler::::new(0, cx, |state, cx| { + let theme = &cx.global::().theme.workspace.status_bar; + let style = theme.active_language.style_for(state, false); + Label::new(active_language.to_string(), style.text.clone()) + .contained() + .with_style(style.container) + .boxed() + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle)) + .boxed() + } else { + Empty::new().boxed() + } + } +} + +impl StatusItemView for ActiveBufferLanguage { + fn set_active_pane_item( + &mut self, + active_pane_item: Option<&dyn ItemHandle>, + cx: &mut ViewContext, + ) { + if let Some(editor) = active_pane_item.and_then(|item| item.act_as::(cx)) { + self._observe_active_editor = Some(cx.observe(&editor, Self::update_language)); + self.update_language(editor, cx); + } else { + self.active_language = None; + self._observe_active_editor = None; + } + + cx.notify(); + } +} diff --git a/crates/language_selector/src/language_selector.rs b/crates/language_selector/src/language_selector.rs index 786dd5abe0ba92a6425cc94e197bc4fc56bb2762..711e36f9c442ca1eaf297f7a14ed66a6cd0060bc 100644 --- a/crates/language_selector/src/language_selector.rs +++ b/crates/language_selector/src/language_selector.rs @@ -1,5 +1,6 @@ -use std::sync::Arc; +mod active_buffer_language; +pub use active_buffer_language::ActiveBufferLanguage; use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ @@ -10,6 +11,7 @@ use language::{Buffer, LanguageRegistry}; use picker::{Picker, PickerDelegate}; use project::Project; use settings::Settings; +use std::sync::Arc; use workspace::{AppState, Workspace}; actions!(language_selector, [Toggle]); diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 56ef87e0af3e3ca6b955d75e9adf843ef6cff833..aa379bf838818121ece93ccbc639746d8b9aaa64 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -277,6 +277,7 @@ pub struct StatusBar { pub height: f32, pub item_spacing: f32, pub cursor_position: TextStyle, + pub active_language: Interactive, pub auto_update_progress_message: TextStyle, pub auto_update_done_message: TextStyle, pub lsp_status: Interactive, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index f853e41c0429cddc1cb1c5fcee14dff429cfb3a9..664833de1e257a948a11b3f4b48578f6d42610ab 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -338,6 +338,7 @@ pub fn initialize_workspace( cx.add_view(|cx| diagnostics::items::DiagnosticIndicator::new(workspace.project(), cx)); let activity_indicator = activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx); + let active_buffer_language = cx.add_view(|_| language_selector::ActiveBufferLanguage::new()); let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new()); let feedback_button = cx.add_view(|_| feedback::deploy_feedback_button::DeployFeedbackButton {}); @@ -346,6 +347,7 @@ pub fn initialize_workspace( status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); status_bar.add_right_item(cursor_position, cx); + status_bar.add_right_item(active_buffer_language, cx); }); auto_update::notify_of_any_new_update(cx.weak_handle(), cx); diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/styleTree/statusBar.ts index eb72346788a78b62be63600587eefc981676dc7d..de33f3d1d5361286557b5e7c8415782f8d36784f 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/styleTree/statusBar.ts @@ -25,6 +25,12 @@ export default function statusBar(colorScheme: ColorScheme) { }, border: border(layer, { top: true, overlay: true }), cursorPosition: text(layer, "sans", "variant"), + activeLanguage: { + ...text(layer, "sans", "variant"), + hover: { + ...text(layer, "sans", "on") + } + }, autoUpdateProgressMessage: text(layer, "sans", "variant"), autoUpdateDoneMessage: text(layer, "sans", "variant"), lspStatus: { @@ -45,9 +51,10 @@ export default function statusBar(colorScheme: ColorScheme) { hover: text(layer, "sans", "hovered"), }, feedback: { + margin: { left: 2 }, color: foreground(layer, "variant"), iconWidth: 14, - buttonWidth: 20, + buttonWidth: 14, hover: { color: foreground(layer, "on"), }, From f50b51bdad4333f94a65a6e3eea45026a9b246d9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 10 Mar 2023 17:37:45 +0100 Subject: [PATCH 4/7] Adjust styling --- crates/theme/src/theme.rs | 2 +- crates/zed/src/zed.rs | 2 +- styles/src/styleTree/statusBar.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index aa379bf838818121ece93ccbc639746d8b9aaa64..87504d6cd98423424d6994e7f06d6ef1f2e666ed 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -277,7 +277,7 @@ pub struct StatusBar { pub height: f32, pub item_spacing: f32, pub cursor_position: TextStyle, - pub active_language: Interactive, + pub active_language: Interactive, pub auto_update_progress_message: TextStyle, pub auto_update_done_message: TextStyle, pub lsp_status: Interactive, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 664833de1e257a948a11b3f4b48578f6d42610ab..26989102e4221dcca3fdcef447271d4b232a7feb 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -346,8 +346,8 @@ pub fn initialize_workspace( status_bar.add_left_item(feedback_button, cx); status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); - status_bar.add_right_item(cursor_position, cx); status_bar.add_right_item(active_buffer_language, cx); + status_bar.add_right_item(cursor_position, cx); }); auto_update::notify_of_any_new_update(cx.weak_handle(), cx); diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/styleTree/statusBar.ts index de33f3d1d5361286557b5e7c8415782f8d36784f..e5c07c07c2b1598a04e31ec34b20fd7a16afc9fe 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/styleTree/statusBar.ts @@ -26,6 +26,7 @@ export default function statusBar(colorScheme: ColorScheme) { border: border(layer, { top: true, overlay: true }), cursorPosition: text(layer, "sans", "variant"), activeLanguage: { + padding: { left: 6, right: 6 }, ...text(layer, "sans", "variant"), hover: { ...text(layer, "sans", "on") From bb721a08f56e87391280937686e1be2ce3a95ef4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 10 Mar 2023 17:43:48 +0100 Subject: [PATCH 5/7] :lipstick: --- crates/language_selector/src/active_buffer_language.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index c4129d1448c1eee0712a5d43765b3d08ea2e4b23..1da0b4323c5134da7a0336f6816509ccbf0ba7d3 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -27,8 +27,9 @@ impl ActiveBufferLanguage { } fn update_language(&mut self, editor: ViewHandle, cx: &mut ViewContext) { - let editor = editor.read(cx); self.active_language.take(); + + let editor = editor.read(cx); if let Some((_, buffer, _)) = editor.active_excerpt(cx) { if let Some(language) = buffer.read(cx).language() { self.active_language = Some(language.name()); From e45104a1c046cd2dd441f0363cd25be933763627 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 10 Mar 2023 12:48:11 -0800 Subject: [PATCH 6/7] Move feedback to overflow menu and help menu --- Cargo.lock | 1 + crates/collab_ui/Cargo.toml | 1 + crates/collab_ui/src/collab_titlebar_item.rs | 18 ++++++++++++++---- crates/zed/src/menus.rs | 1 + crates/zed/src/zed.rs | 3 --- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f19d4455f957463f61e8db34ff9fdb135ed4f3b..ade18d799eca665a9c4c03508a3fda7552f13748 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1259,6 +1259,7 @@ dependencies = [ "collections", "context_menu", "editor", + "feedback", "futures 0.3.25", "fuzzy", "gpui", diff --git a/crates/collab_ui/Cargo.toml b/crates/collab_ui/Cargo.toml index 899f8cc8b4204dc0c2b6d0c060aafb1a42e7e907..2afeb8ad8ae755b1f8b554d8e4a9bc15732767f3 100644 --- a/crates/collab_ui/Cargo.toml +++ b/crates/collab_ui/Cargo.toml @@ -29,6 +29,7 @@ clock = { path = "../clock" } collections = { path = "../collections" } context_menu = { path = "../context_menu" } editor = { path = "../editor" } +feedback = { path = "../feedback" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } menu = { path = "../menu" } diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index c838f6a55fc3ec716571a9261066473910a6f413..4968097ac5e163261e0002c939ed4beaad6103de 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -304,12 +304,22 @@ impl CollabTitlebarItem { label: "Sign out".into(), action: Box::new(SignOut), }, + ContextMenuItem::Item { + label: "Give Feedback".into(), + action: Box::new(feedback::feedback_editor::GiveFeedback), + }, ] } else { - vec![ContextMenuItem::Item { - label: "Sign in".into(), - action: Box::new(Authenticate), - }] + vec![ + ContextMenuItem::Item { + label: "Sign in".into(), + action: Box::new(Authenticate), + }, + ContextMenuItem::Item { + label: "Give Feedback".into(), + action: Box::new(feedback::feedback_editor::GiveFeedback), + }, + ] }; user_menu.show( diff --git a/crates/zed/src/menus.rs b/crates/zed/src/menus.rs index bb519c7a9505bc2de07fa60c70014be3b4fbc169..2c16d4ba8bedb12033e6d1163c9ff59c2fc48a14 100644 --- a/crates/zed/src/menus.rs +++ b/crates/zed/src/menus.rs @@ -140,6 +140,7 @@ pub fn menus() -> Vec> { MenuItem::action("View Telemetry Log", crate::OpenTelemetryLog), MenuItem::action("View Dependency Licenses", crate::OpenLicenses), MenuItem::separator(), + MenuItem::action("Give us feedback", feedback::feedback_editor::GiveFeedback), MenuItem::action( "Copy System Specs Into Clipboard", feedback::CopySystemSpecsIntoClipboard, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 26989102e4221dcca3fdcef447271d4b232a7feb..d742c733e52e275aa26f10ee9034831bc66528ad 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -340,10 +340,7 @@ pub fn initialize_workspace( activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx); let active_buffer_language = cx.add_view(|_| language_selector::ActiveBufferLanguage::new()); let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new()); - let feedback_button = - cx.add_view(|_| feedback::deploy_feedback_button::DeployFeedbackButton {}); workspace.status_bar().update(cx, |status_bar, cx| { - status_bar.add_left_item(feedback_button, cx); status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); status_bar.add_right_item(active_buffer_language, cx); From c8de738972142fba2fefe7ea59aff501d93d5bb6 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 10 Mar 2023 16:19:33 -0800 Subject: [PATCH 7/7] Align feedback button styles with other sidebar buttons Make feedback button reflect whether you're in a feedback buffer --- crates/feedback/src/deploy_feedback_button.rs | 47 +++++++++++++++---- crates/theme/src/theme.rs | 1 - crates/zed/src/zed.rs | 3 ++ styles/src/styleTree/statusBar.ts | 9 ---- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/crates/feedback/src/deploy_feedback_button.rs b/crates/feedback/src/deploy_feedback_button.rs index 7519d2d06e649164cdd742dca4d3dc92e51d7899..222c542eed4dba57e31a1b61d1099b4a72f02e24 100644 --- a/crates/feedback/src/deploy_feedback_button.rs +++ b/crates/feedback/src/deploy_feedback_button.rs @@ -2,39 +2,58 @@ use gpui::{elements::*, CursorStyle, Entity, MouseButton, RenderContext, View, V use settings::Settings; use workspace::{item::ItemHandle, StatusItemView}; -use crate::feedback_editor::GiveFeedback; +use crate::feedback_editor::{FeedbackEditor, GiveFeedback}; -pub struct DeployFeedbackButton; +pub struct DeployFeedbackButton { + active: bool, +} impl Entity for DeployFeedbackButton { type Event = (); } +impl DeployFeedbackButton { + pub fn new() -> Self { + DeployFeedbackButton { active: false } + } +} + impl View for DeployFeedbackButton { fn ui_name() -> &'static str { "DeployFeedbackButton" } fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox { + let active = self.active; Stack::new() .with_child( MouseEventHandler::::new(0, cx, |state, cx| { let theme = &cx.global::().theme; - let style = &theme.workspace.status_bar.feedback.style_for(state, false); + let style = &theme + .workspace + .status_bar + .sidebar_buttons + .item + .style_for(state, active); + Svg::new("icons/speech_bubble_12.svg") - .with_color(style.color) + .with_color(style.icon_color) .constrained() - .with_width(style.icon_width) + .with_width(style.icon_size) .aligned() .constrained() - .with_width(style.button_width) - .with_height(style.button_width) + .with_width(style.icon_size) + .with_height(style.icon_size) .contained() .with_style(style.container) .boxed() }) .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback)) + .on_click(MouseButton::Left, move |_, cx| { + if !active { + cx.dispatch_action(GiveFeedback) + } + }) .boxed(), ) .boxed() @@ -42,5 +61,15 @@ impl View for DeployFeedbackButton { } impl StatusItemView for DeployFeedbackButton { - fn set_active_pane_item(&mut self, _: Option<&dyn ItemHandle>, _: &mut ViewContext) {} + fn set_active_pane_item(&mut self, item: Option<&dyn ItemHandle>, cx: &mut ViewContext) { + if let Some(item) = item { + if let Some(_) = item.downcast::() { + self.active = true; + cx.notify(); + return; + } + } + self.active = false; + cx.notify(); + } } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 87504d6cd98423424d6994e7f06d6ef1f2e666ed..70ee22d37d4d98e74b90a09c2848a52326280fab 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -281,7 +281,6 @@ pub struct StatusBar { pub auto_update_progress_message: TextStyle, pub auto_update_done_message: TextStyle, pub lsp_status: Interactive, - pub feedback: Interactive, pub sidebar_buttons: StatusBarSidebarButtons, pub diagnostic_summary: Interactive, pub diagnostic_message: Interactive, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index d742c733e52e275aa26f10ee9034831bc66528ad..79ec9b411857e44475ff379927561efae32e0ae7 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -339,10 +339,13 @@ pub fn initialize_workspace( let activity_indicator = activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx); let active_buffer_language = cx.add_view(|_| language_selector::ActiveBufferLanguage::new()); + let feedback_button = + cx.add_view(|_| feedback::deploy_feedback_button::DeployFeedbackButton::new()); let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new()); workspace.status_bar().update(cx, |status_bar, cx| { status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); + status_bar.add_right_item(feedback_button, cx); status_bar.add_right_item(active_buffer_language, cx); status_bar.add_right_item(cursor_position, cx); }); diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/styleTree/statusBar.ts index e5c07c07c2b1598a04e31ec34b20fd7a16afc9fe..9fa427d302f19008f169c77e847cf67031e63562 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/styleTree/statusBar.ts @@ -51,15 +51,6 @@ export default function statusBar(colorScheme: ColorScheme) { ...text(layer, "sans"), hover: text(layer, "sans", "hovered"), }, - feedback: { - margin: { left: 2 }, - color: foreground(layer, "variant"), - iconWidth: 14, - buttonWidth: 14, - hover: { - color: foreground(layer, "on"), - }, - }, diagnosticSummary: { height: 20, iconWidth: 16,