Add debug icon to toggle debug panel (#23)
* Add debug icon to toggle debug panel * Add setting to wether to show the debug button * Fix clippy
This commit is contained in:
@@ -1016,7 +1016,8 @@
|
||||
|
||||
"debugger": {
|
||||
// Save breakpoints across different Zed sessions
|
||||
"save_breakpoints": true
|
||||
"save_breakpoints": true,
|
||||
"button": true
|
||||
},
|
||||
|
||||
// Configures the Context Server Protocol binaries
|
||||
|
||||
@@ -6,6 +6,7 @@ use settings::{Settings, SettingsSources};
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
pub struct DebuggerSettings {
|
||||
pub save_breakpoints: bool,
|
||||
pub button: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, JsonSchema, Clone)]
|
||||
@@ -14,6 +15,10 @@ pub struct DebuggerSettingsContent {
|
||||
///
|
||||
/// Default: true
|
||||
pub save_breakpoints: Option<bool>,
|
||||
/// Whether to show the debug button in the status bar.
|
||||
///
|
||||
/// Default: true
|
||||
pub button: Option<bool>,
|
||||
}
|
||||
|
||||
impl Settings for DebuggerSettings {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::debugger_panel_item::DebugPanelItem;
|
||||
use anyhow::Result;
|
||||
use dap::client::{DebugAdapterClientId, ThreadState, ThreadStatus};
|
||||
use dap::debugger_settings::DebuggerSettings;
|
||||
use dap::requests::{Request, Scopes, StackTrace, StartDebugging};
|
||||
use dap::transport::Payload;
|
||||
use dap::{client::DebugAdapterClient, transport::Events};
|
||||
@@ -16,6 +17,7 @@ use gpui::{
|
||||
Subscription, Task, View, ViewContext, WeakView,
|
||||
};
|
||||
use serde_json::json;
|
||||
use settings::Settings;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
@@ -693,11 +695,15 @@ impl Panel for DebugPanel {
|
||||
}
|
||||
|
||||
fn icon(&self, _cx: &WindowContext) -> Option<IconName> {
|
||||
None
|
||||
Some(IconName::Debug)
|
||||
}
|
||||
|
||||
fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {
|
||||
None
|
||||
fn icon_tooltip(&self, cx: &WindowContext) -> Option<&'static str> {
|
||||
if DebuggerSettings::get_global(cx).button {
|
||||
Some("Debug Panel")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_action(&self) -> Box<dyn Action> {
|
||||
|
||||
@@ -160,6 +160,7 @@ pub enum IconName {
|
||||
DebugStepInto,
|
||||
DebugStepOut,
|
||||
DebugRestart,
|
||||
Debug,
|
||||
DebugStop,
|
||||
DebugDisconnect,
|
||||
DatabaseZap,
|
||||
@@ -331,6 +332,7 @@ impl IconName {
|
||||
IconName::Copy => "icons/copy.svg",
|
||||
IconName::CountdownTimer => "icons/countdown_timer.svg",
|
||||
IconName::Dash => "icons/dash.svg",
|
||||
IconName::Debug => "icons/debug.svg",
|
||||
IconName::DebugPause => "icons/debug-pause.svg",
|
||||
IconName::DebugContinue => "icons/debug-continue.svg",
|
||||
IconName::DebugStepOver => "icons/debug-step-over.svg",
|
||||
|
||||
Reference in New Issue
Block a user