1use dap_types::SteppingGranularity;
2use gpui::{App, Global};
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use settings::{Settings, SettingsSources};
6
7#[derive(Serialize, Deserialize, JsonSchema, Clone, Copy)]
8#[serde(default)]
9pub struct DebuggerSettings {
10 /// Determines the stepping granularity.
11 ///
12 /// Default: line
13 pub stepping_granularity: SteppingGranularity,
14 /// Whether the breakpoints should be reused across Zed sessions.
15 ///
16 /// Default: true
17 pub save_breakpoints: bool,
18 /// Whether to show the debug button in the status bar.
19 ///
20 /// Default: true
21 pub button: bool,
22 /// Time in milliseconds until timeout error when connecting to a TCP debug adapter
23 ///
24 /// Default: 2000ms
25 pub timeout: u64,
26 /// Whether to log messages between active debug adapters and Zed
27 ///
28 /// Default: true
29 pub log_dap_communications: bool,
30 /// Whether to format dap messages in when adding them to debug adapter logger
31 ///
32 /// Default: true
33 pub format_dap_log_messages: bool,
34}
35
36impl Default for DebuggerSettings {
37 fn default() -> Self {
38 Self {
39 button: true,
40 save_breakpoints: true,
41 stepping_granularity: SteppingGranularity::Line,
42 timeout: 2000,
43 log_dap_communications: true,
44 format_dap_log_messages: true,
45 }
46 }
47}
48
49impl Settings for DebuggerSettings {
50 const KEY: Option<&'static str> = Some("debugger");
51
52 type FileContent = Self;
53
54 fn load(sources: SettingsSources<Self::FileContent>, _: &mut App) -> anyhow::Result<Self> {
55 sources.json_merge()
56 }
57
58 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
59}
60
61impl Global for DebuggerSettings {}