dap: add missing fields to structs

pull/574/head
Dmitry Sharshakov 3 years ago committed by Blaž Hrastnik
parent 0fa127b105
commit e11b67b0db

@ -30,6 +30,9 @@ pub async fn main() -> Result<()> {
vec![SourceBreakpoint { vec![SourceBreakpoint {
line: 8, line: 8,
column: Some(2), column: Some(2),
condition: None,
hit_condition: None,
log_message: None,
}] }]
) )
.await .await

@ -15,12 +15,13 @@ use tokio::{
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DebuggerCapabilities { pub struct DebuggerCapabilities {
supports_configuration_done_request: bool, pub supports_configuration_done_request: Option<bool>,
supports_function_breakpoints: bool, pub supports_function_breakpoints: Option<bool>,
supports_conditional_breakpoints: bool, pub supports_conditional_breakpoints: Option<bool>,
supports_exception_info_request: bool, pub supports_exception_info_request: Option<bool>,
support_terminate_debuggee: bool, pub support_terminate_debuggee: Option<bool>,
supports_delayed_stack_trace_loading: bool, pub supports_delayed_stack_trace_loading: Option<bool>,
// TODO: complete this
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@ -43,7 +44,7 @@ struct InitializeArguments {
supports_invalidated_event: bool, 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)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct LaunchArguments { struct LaunchArguments {
@ -51,10 +52,24 @@ struct LaunchArguments {
program: String, 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)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Source { pub struct Source {
path: Option<String>, pub name: Option<String>,
pub path: Option<String>,
pub source_reference: Option<usize>,
pub presentation_hint: Option<String>,
pub origin: Option<String>,
pub sources: Option<Vec<Source>>,
pub adapter_data: Option<Value>,
pub checksums: Option<Vec<Checksum>>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@ -62,6 +77,9 @@ pub struct Source {
pub struct SourceBreakpoint { pub struct SourceBreakpoint {
pub line: usize, pub line: usize,
pub column: Option<usize>, pub column: Option<usize>,
pub condition: Option<String>,
pub hit_condition: Option<String>,
pub log_message: Option<String>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@ -69,6 +87,8 @@ pub struct SourceBreakpoint {
struct SetBreakpointsArguments { struct SetBreakpointsArguments {
source: Source, source: Source,
breakpoints: Option<Vec<SourceBreakpoint>>, breakpoints: Option<Vec<SourceBreakpoint>>,
// lines is deprecated
source_modified: Option<bool>,
} }
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@ -137,7 +157,7 @@ pub struct StackFrame {
pub end_column: Option<usize>, pub end_column: Option<usize>,
pub can_restart: Option<bool>, pub can_restart: Option<bool>,
pub instruction_pointer_reference: Option<String>, pub instruction_pointer_reference: Option<String>,
// module_id pub module_id: Option<Value>,
pub presentation_hint: Option<String>, pub presentation_hint: Option<String>,
} }
@ -271,9 +291,6 @@ impl Client {
capabilities: None, capabilities: None,
}; };
// TODO: async client.initialize()
// maybe use an arc<atomic> flag
Ok(client) Ok(client)
} }
@ -374,8 +391,18 @@ impl Client {
breakpoints: Vec<SourceBreakpoint>, breakpoints: Vec<SourceBreakpoint>,
) -> Result<Option<Vec<Breakpoint>>> { ) -> Result<Option<Vec<Breakpoint>>> {
let args = SetBreakpointsArguments { 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), breakpoints: Some(breakpoints),
source_modified: Some(false),
}; };
let response = self let response = self

Loading…
Cancel
Save