From 8883885ecbca796a35885d70fa0c6620807b8c6c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 17 Jun 2025 14:50:46 -0400 Subject: [PATCH] debugger: Improve debugger panel empty state (#32889) Before: ![CleanShot 2025-06-17 at 13 48 58@2x](https://github.com/user-attachments/assets/16ecebfa-871e-4a2d-b6a3-2178de70aaef) After: ![CleanShot 2025-06-17 at 13 49 24@2x](https://github.com/user-attachments/assets/2d8a0444-6088-45f1-a880-0bdd0aef968e) Release Notes: - N/A (Beta: Improved the debugger panel when there are no currently active sessions) --- assets/icons/blocks.svg | 2 +- crates/debugger_ui/src/debugger_panel.rs | 76 ++++++++++++++++-------- crates/zed/src/zed.rs | 3 +- crates/zed/src/zed/app_menus.rs | 2 +- crates/zed_actions/src/lib.rs | 9 ++- 5 files changed, 61 insertions(+), 31 deletions(-) diff --git a/assets/icons/blocks.svg b/assets/icons/blocks.svg index 42d44c3f95..588d49abbc 100644 --- a/assets/icons/blocks.svg +++ b/assets/icons/blocks.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index bea3b39657..05620359a9 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -1428,33 +1428,57 @@ impl Render for DebugPanel { .items_center() .justify_center() .child( - h_flex().child( - Label::new("No Debugging Sessions") - .size(LabelSize::Small) - .color(Color::Muted), - ), - ) - .child( - v_flex().gap_4().items_center() - .justify_center() - .child( - h_flex().flex_shrink().child( - Button::new("spawn-new-session-empty-state", "New Session") - .size(ButtonSize::Large) - .on_click(|_, window, cx| { - window.dispatch_action(crate::Start.boxed_clone(), cx); - }) + h_flex() + .items_start() + .gap_8() + .child( + v_flex() + .gap_2() + .pr_8() + .child( + Button::new("spawn-new-session-empty-state", "New Session") + .icon(IconName::Plus) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + .icon_position(IconPosition::Start) + .on_click(|_, window, cx| { + window.dispatch_action(crate::Start.boxed_clone(), cx); + }) + ) + .child( + Button::new("edit-debug-settings", "Edit debug.json") + .icon(IconName::Code) + .icon_size(IconSize::XSmall) + .color(Color::Muted) + .icon_color(Color::Muted) + .icon_position(IconPosition::Start) + .on_click(|_, window, cx| { + window.dispatch_action(zed_actions::OpenProjectDebugTasks.boxed_clone(), cx); + }) + ) + .child( + Button::new("open-debugger-docs", "Debugger Docs") + .icon(IconName::Book) + .color(Color::Muted) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + .icon_position(IconPosition::Start) + .on_click(|_, _, cx| { + cx.open_url("https://zed.dev/docs/debugger") + }) + ) + .child( + Button::new("spawn-new-session-install-extensions", "Debugger Extensions") + .icon(IconName::Blocks) + .color(Color::Muted) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + .icon_position(IconPosition::Start) + .on_click(|_, window, cx| { + window.dispatch_action(zed_actions::Extensions { category_filter: Some(zed_actions::ExtensionCategoryFilter::DebugAdapters)}.boxed_clone(), cx); + }) + ) ) - ) - .child( - h_flex().flex_shrink().child( - Button::new("spawn-new-session-install-extensions", "Install Debug Extensions") - .label_size(LabelSize::Small) - .on_click(|_, window, cx| { - window.dispatch_action(zed_actions::Extensions { category_filter: Some(zed_actions::ExtensionCategoryFilter::DebugAdapters)}.boxed_clone(), cx); - }) - ) - ) ) ) } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 0b6d0facf5..419065d4a5 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -86,7 +86,6 @@ actions!( OpenDefaultSettings, OpenProjectSettings, OpenProjectTasks, - OpenProjectDebugTasks, OpenTasks, OpenDebugTasks, ResetDatabase, @@ -1512,7 +1511,7 @@ fn open_project_tasks_file( fn open_project_debug_tasks_file( workspace: &mut Workspace, - _: &OpenProjectDebugTasks, + _: &zed_actions::OpenProjectDebugTasks, window: &mut Window, cx: &mut Context, ) { diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index 6b7291cbca..dac9f6495b 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -215,7 +215,7 @@ pub fn app_menus() -> Vec { MenuItem::action("Start Debugger", debugger_ui::Start), MenuItem::separator(), MenuItem::action("Edit tasks.json...", crate::zed::OpenProjectTasks), - MenuItem::action("Edit debug.json...", crate::zed::OpenProjectDebugTasks), + MenuItem::action("Edit debug.json...", zed_actions::OpenProjectDebugTasks), MenuItem::separator(), MenuItem::action("Continue", debugger_ui::Continue), MenuItem::action("Step Over", debugger_ui::StepOver), diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 2afc8d38e6..5c28140b11 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -349,4 +349,11 @@ pub mod outline { actions!(zed_predict_onboarding, [OpenZedPredictOnboarding]); actions!(git_onboarding, [OpenGitIntegrationOnboarding]); -actions!(debugger, [ToggleEnableBreakpoint, UnsetBreakpoint]); +actions!( + debugger, + [ + ToggleEnableBreakpoint, + UnsetBreakpoint, + OpenProjectDebugTasks, + ] +);