Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

workspace: Move panel telemetry to workspace level (#46809)

Katie Geer5e5951a43efb
diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs
index 310ef8133e4..b3397dd48f5 100644
--- a/crates/workspace/src/dock.rs
+++ b/crates/workspace/src/dock.rs
@@ -1045,11 +1045,6 @@ impl Render for PanelButtons {
.on_click({
let action = action.boxed_clone();
move |_, window, cx| {
- telemetry::event!(
- "Panel Button Clicked",
- name = name,
- toggle_state = !is_open
- );
window.focus(&focus_handle, cx);
window.dispatch_action(action.boxed_clone(), cx)
}
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index af8e274f6ed..4dad00f1586 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -3255,6 +3255,14 @@ impl Workspace {
let other_is_zoomed = self.zoomed.is_some() && self.zoomed_position != Some(dock_side);
let was_visible = self.is_dock_at_position_open(dock_side, cx) && !other_is_zoomed;
+
+ if let Some(panel) = self.dock_at_position(dock_side).read(cx).active_panel() {
+ telemetry::event!(
+ "Panel Button Clicked",
+ name = panel.persistent_name(),
+ toggle_state = !was_visible
+ );
+ }
if was_visible {
self.save_open_dock_positions(cx);
}
@@ -3415,6 +3423,13 @@ impl Workspace {
did_focus_panel = !panel.panel_focus_handle(cx).contains_focused(window, cx);
did_focus_panel
});
+
+ telemetry::event!(
+ "Panel Button Clicked",
+ name = T::persistent_name(),
+ toggle_state = did_focus_panel
+ );
+
did_focus_panel
}