From e11b67b0db32c6459ab672a23b04c66de093e4ee Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Thu, 12 Aug 2021 21:23:55 +0300 Subject: [PATCH] dap: add missing fields to structs --- helix-dap/examples/dap-basic.rs | 3 ++ helix-dap/src/client.rs | 53 +++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/helix-dap/examples/dap-basic.rs b/helix-dap/examples/dap-basic.rs index 9c4f2f3e..81decd1a 100644 --- a/helix-dap/examples/dap-basic.rs +++ b/helix-dap/examples/dap-basic.rs @@ -30,6 +30,9 @@ pub async fn main() -> Result<()> { vec![SourceBreakpoint { line: 8, column: Some(2), + condition: None, + hit_condition: None, + log_message: None, }] ) .await diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index b41d1d43..e8ad2c6f 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -15,12 +15,13 @@ use tokio::{ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DebuggerCapabilities { - supports_configuration_done_request: bool, - supports_function_breakpoints: bool, - supports_conditional_breakpoints: bool, - supports_exception_info_request: bool, - support_terminate_debuggee: bool, - supports_delayed_stack_trace_loading: bool, + pub supports_configuration_done_request: Option, + pub supports_function_breakpoints: Option, + pub supports_conditional_breakpoints: Option, + pub supports_exception_info_request: Option, + pub support_terminate_debuggee: Option, + pub supports_delayed_stack_trace_loading: Option, + // TODO: complete this } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] @@ -43,7 +44,7 @@ struct InitializeArguments { supports_invalidated_event: bool, } -// TODO: split out +// TODO: split out, as it's a debugger-specific payload not covered by standard #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] struct LaunchArguments { @@ -51,10 +52,24 @@ struct LaunchArguments { program: String, } +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Checksum { + pub algorithm: String, + pub checksum: String, +} + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Source { - path: Option, + pub name: Option, + pub path: Option, + pub source_reference: Option, + pub presentation_hint: Option, + pub origin: Option, + pub sources: Option>, + pub adapter_data: Option, + pub checksums: Option>, } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] @@ -62,6 +77,9 @@ pub struct Source { pub struct SourceBreakpoint { pub line: usize, pub column: Option, + pub condition: Option, + pub hit_condition: Option, + pub log_message: Option, } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] @@ -69,6 +87,8 @@ pub struct SourceBreakpoint { struct SetBreakpointsArguments { source: Source, breakpoints: Option>, + // lines is deprecated + source_modified: Option, } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] @@ -137,7 +157,7 @@ pub struct StackFrame { pub end_column: Option, pub can_restart: Option, pub instruction_pointer_reference: Option, - // module_id + pub module_id: Option, pub presentation_hint: Option, } @@ -271,9 +291,6 @@ impl Client { capabilities: None, }; - // TODO: async client.initialize() - // maybe use an arc flag - Ok(client) } @@ -374,8 +391,18 @@ impl Client { breakpoints: Vec, ) -> Result>> { let args = SetBreakpointsArguments { - source: Source { path: Some(file) }, + source: Source { + path: Some(file), + name: None, + source_reference: None, + presentation_hint: None, + origin: None, + sources: None, + adapter_data: None, + checksums: None, + }, breakpoints: Some(breakpoints), + source_modified: Some(false), }; let response = self