on master help sign in
dap: add missing fields to structs
commite11b67b0db32c6459ab672a23b04c66de093e4ee authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateThu 12 Aug 2021, 21:23 (5 years ago) parent0fa127b
2 files changed+43−13
helix-dap/examples/dap-basic.rs+3 helix-dap/src/client.rs+40−13
helix-dap/examples/dap-basic.rs+3
@@ -30,6 +30,9 @@ pub async fn main() -> Result<()> {
3030 vec![SourceBreakpoint {
3131 line: 8,
3232 column: Some(2),
33+ condition: None,
34+ hit_condition: None,
35+ log_message: None,
3336 }]
3437 )
3538 .await
helix-dap/src/client.rs+40−13
@@ -15,12 +15,13 @@ use tokio::{
1515#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
1616#[serde(rename_all = "camelCase")]
1717pub struct DebuggerCapabilities {
18− supports_configuration_done_request: bool,
19− supports_function_breakpoints: bool,
20− supports_conditional_breakpoints: bool,
21− supports_exception_info_request: bool,
22− support_terminate_debuggee: bool,
23− supports_delayed_stack_trace_loading: bool,
18+ pub supports_configuration_done_request: Option<bool>,
19+ pub supports_function_breakpoints: Option<bool>,
20+ pub supports_conditional_breakpoints: Option<bool>,
21+ pub supports_exception_info_request: Option<bool>,
22+ pub support_terminate_debuggee: Option<bool>,
23+ pub supports_delayed_stack_trace_loading: Option<bool>,
24+ // TODO: complete this
2425}
2526
2627#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -43,7 +44,7 @@ struct InitializeArguments {
4344 supports_invalidated_event: bool,
4445}
4546
46−// TODO: split out
47+// TODO: split out, as it's a debugger-specific payload not covered by standard
4748#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
4849#[serde(rename_all = "camelCase")]
4950struct LaunchArguments {
@@ -51,10 +52,24 @@ struct LaunchArguments {
5152 program: String,
5253}
5354
55+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
56+#[serde(rename_all = "camelCase")]
57+pub struct Checksum {
58+ pub algorithm: String,
59+ pub checksum: String,
60+}
61+
5462#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
5563#[serde(rename_all = "camelCase")]
5664pub struct Source {
57− path: Option<String>,
65+ pub name: Option<String>,
66+ pub path: Option<String>,
67+ pub source_reference: Option<usize>,
68+ pub presentation_hint: Option<String>,
69+ pub origin: Option<String>,
70+ pub sources: Option<Vec<Source>>,
71+ pub adapter_data: Option<Value>,
72+ pub checksums: Option<Vec<Checksum>>,
5873}
5974
6075#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -62,6 +77,9 @@ pub struct Source {
6277pub struct SourceBreakpoint {
6378 pub line: usize,
6479 pub column: Option<usize>,
80+ pub condition: Option<String>,
81+ pub hit_condition: Option<String>,
82+ pub log_message: Option<String>,
6583}
6684
6785#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -69,6 +87,8 @@ pub struct SourceBreakpoint {
6987struct SetBreakpointsArguments {
7088 source: Source,
7189 breakpoints: Option<Vec<SourceBreakpoint>>,
90+ // lines is deprecated
91+ source_modified: Option<bool>,
7292}
7393
7494#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -137,7 +157,7 @@ pub struct StackFrame {
137157 pub end_column: Option<usize>,
138158 pub can_restart: Option<bool>,
139159 pub instruction_pointer_reference: Option<String>,
140− // module_id
160+ pub module_id: Option<Value>,
141161 pub presentation_hint: Option<String>,
142162}
143163
@@ -271,9 +291,6 @@ impl Client {
271291 capabilities: None,
272292 };
273293
274− // TODO: async client.initialize()
275− // maybe use an arc<atomic> flag
276−
277294 Ok(client)
278295 }
279296
@@ -374,8 +391,18 @@ impl Client {
374391 breakpoints: Vec<SourceBreakpoint>,
375392 ) -> Result<Option<Vec<Breakpoint>>> {
376393 let args = SetBreakpointsArguments {
377− source: Source { path: Some(file) },
394+ source: Source {
395+ path: Some(file),
396+ name: None,
397+ source_reference: None,
398+ presentation_hint: None,
399+ origin: None,
400+ sources: None,
401+ adapter_data: None,
402+ checksums: None,
403+ },
378404 breakpoints: Some(breakpoints),
405+ source_modified: Some(false),
379406 };
380407
381408 let response = self