From dabec2d7993b23d08f03b52dc08176d437a110a9 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sun, 22 Aug 2021 15:59:42 +0300 Subject: Fix line endings --- helix-dap/src/types.rs | 1304 ++++++++++++++++++++++++------------------------ 1 file changed, 652 insertions(+), 652 deletions(-) (limited to 'helix-dap') diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index bb73e5e9..26cd69fb 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -1,652 +1,652 @@ -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use std::path::PathBuf; - -pub trait Request { - type Arguments: serde::de::DeserializeOwned + serde::Serialize; - type Result: serde::de::DeserializeOwned + serde::Serialize; - const COMMAND: &'static str; -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ColumnDescriptor { - pub attribute_name: String, - pub label: String, - pub format: Option, - #[serde(rename = "type")] - pub col_type: Option, - pub width: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ExceptionBreakpointsFilter { - pub filter: String, - pub label: String, - pub description: Option, - pub default: Option, - pub supports_condition: Option, - pub condition_description: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct DebuggerCapabilities { - pub supports_configuration_done_request: Option, - pub supports_function_breakpoints: Option, - pub supports_conditional_breakpoints: Option, - pub supports_hit_conditional_breakpoints: Option, - pub supports_evaluate_for_hovers: Option, - pub supports_step_back: Option, - pub supports_set_variable: Option, - pub supports_restart_frame: Option, - pub supports_goto_targets_request: Option, - pub supports_step_in_targets_request: Option, - pub supports_completions_request: Option, - pub supports_modules_request: Option, - pub supports_restart_request: Option, - pub supports_exception_options: Option, - pub supports_value_formatting_options: Option, - pub supports_exception_info_request: Option, - pub support_terminate_debuggee: Option, - pub support_suspend_debuggee: Option, - pub supports_delayed_stack_trace_loading: Option, - pub supports_loaded_sources_request: Option, - pub supports_log_points: Option, - pub supports_terminate_threads_request: Option, - pub supports_set_expression: Option, - pub supports_terminate_request: Option, - pub supports_data_breakpoints: Option, - pub supports_read_memory_request: Option, - pub supports_write_memory_request: Option, - pub supports_disassemble_request: Option, - pub supports_cancel_request: Option, - pub supports_breakpoint_locations_request: Option, - pub supports_clipboard_context: Option, - pub supports_stepping_granularity: Option, - pub supports_instruction_breakpoints: Option, - pub supports_exception_filter_options: Option, - pub exception_breakpoint_filters: Option>, - pub completion_trigger_characters: Option>, - pub additional_module_columns: Option>, - pub supported_checksum_algorithms: Option>, -} - -impl std::ops::Deref for DebuggerCapabilities { - type Target = Option; - - fn deref(&self) -> &Self::Target { - &self.supports_exception_options - } -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Checksum { - pub algorithm: String, - pub checksum: String, -} - -#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Source { - 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, Default, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -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)] -#[serde(rename_all = "camelCase")] -pub struct Breakpoint { - pub id: Option, - pub verified: bool, - pub message: Option, - pub source: Option, - pub line: Option, - pub column: Option, - pub end_line: Option, - pub end_column: Option, - pub instruction_reference: Option, - pub offset: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct StackFrameFormat { - pub parameters: Option, - pub parameter_types: Option, - pub parameter_names: Option, - pub parameter_values: Option, - pub line: Option, - pub module: Option, - pub include_all: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct StackFrame { - pub id: usize, - pub name: String, - pub source: Option, - pub line: usize, - pub column: usize, - pub end_line: Option, - pub end_column: Option, - pub can_restart: Option, - pub instruction_pointer_reference: Option, - pub module_id: Option, - pub presentation_hint: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Thread { - pub id: usize, - pub name: String, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Scope { - pub name: String, - pub presentation_hint: Option, - pub variables_reference: usize, - pub named_variables: Option, - pub indexed_variables: Option, - pub expensive: bool, - pub source: Option, - pub line: Option, - pub column: Option, - pub end_line: Option, - pub end_column: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ValueFormat { - pub hex: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct VariablePresentationHint { - pub kind: Option, - pub attributes: Option>, - pub visibility: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Variable { - pub name: String, - pub value: String, - #[serde(rename = "type")] - pub data_type: Option, - pub presentation_hint: Option, - pub evaluate_name: Option, - pub variables_reference: usize, - pub named_variables: Option, - pub indexed_variables: Option, - pub memory_reference: Option, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Module { - pub id: String, // TODO: || number - pub name: String, - pub path: Option, - pub is_optimized: Option, - pub is_user_code: Option, - pub version: Option, - pub symbol_status: Option, - pub symbol_file_path: Option, - pub date_time_stamp: Option, - pub address_range: Option, -} - -pub mod requests { - use super::*; - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct InitializeArguments { - #[serde(rename = "clientID")] - pub client_id: Option, - pub client_name: Option, - #[serde(rename = "adapterID")] - pub adapter_id: String, - pub locale: Option, - #[serde(rename = "linesStartAt1")] - pub lines_start_at_one: Option, - #[serde(rename = "columnsStartAt1")] - pub columns_start_at_one: Option, - pub path_format: Option, - pub supports_variable_type: Option, - pub supports_variable_paging: Option, - pub supports_run_in_terminal_request: Option, - pub supports_memory_references: Option, - pub supports_progress_reporting: Option, - pub supports_invalidated_event: Option, - } - - #[derive(Debug)] - pub enum Initialize {} - - impl Request for Initialize { - type Arguments = InitializeArguments; - type Result = DebuggerCapabilities; - const COMMAND: &'static str = "initialize"; - } - - #[derive(Debug)] - pub enum Launch {} - - impl Request for Launch { - type Arguments = Value; - type Result = Value; - const COMMAND: &'static str = "launch"; - } - - #[derive(Debug)] - pub enum Attach {} - - impl Request for Attach { - type Arguments = Value; - type Result = Value; - const COMMAND: &'static str = "attach"; - } - - #[derive(Debug)] - pub enum Disconnect {} - - impl Request for Disconnect { - type Arguments = (); - type Result = (); - const COMMAND: &'static str = "disconnect"; - } - - #[derive(Debug)] - pub enum ConfigurationDone {} - - impl Request for ConfigurationDone { - type Arguments = (); - type Result = (); - const COMMAND: &'static str = "configurationDone"; - } - - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct SetBreakpointsArguments { - pub source: Source, - pub breakpoints: Option>, - // lines is deprecated - pub source_modified: Option, - } - - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct SetBreakpointsResponse { - pub breakpoints: Option>, - } - - #[derive(Debug)] - pub enum SetBreakpoints {} - - impl Request for SetBreakpoints { - type Arguments = SetBreakpointsArguments; - type Result = SetBreakpointsResponse; - const COMMAND: &'static str = "setBreakpoints"; - } - - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct ContinueArguments { - pub thread_id: usize, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct ContinueResponse { - pub all_threads_continued: Option, - } - - #[derive(Debug)] - pub enum Continue {} - - impl Request for Continue { - type Arguments = ContinueArguments; - type Result = ContinueResponse; - const COMMAND: &'static str = "continue"; - } - - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct StackTraceArguments { - pub thread_id: usize, - pub start_frame: Option, - pub levels: Option, - pub format: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct StackTraceResponse { - pub total_frames: Option, - pub stack_frames: Vec, - } - - #[derive(Debug)] - pub enum StackTrace {} - - impl Request for StackTrace { - type Arguments = StackTraceArguments; - type Result = StackTraceResponse; - const COMMAND: &'static str = "stackTrace"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct ThreadsResponse { - pub threads: Vec, - } - - #[derive(Debug)] - pub enum Threads {} - - impl Request for Threads { - type Arguments = (); - type Result = ThreadsResponse; - const COMMAND: &'static str = "threads"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct ScopesArguments { - pub frame_id: usize, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct ScopesResponse { - pub scopes: Vec, - } - - #[derive(Debug)] - pub enum Scopes {} - - impl Request for Scopes { - type Arguments = ScopesArguments; - type Result = ScopesResponse; - const COMMAND: &'static str = "scopes"; - } - - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct VariablesArguments { - pub variables_reference: usize, - pub filter: Option, - pub start: Option, - pub count: Option, - pub format: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct VariablesResponse { - pub variables: Vec, - } - - #[derive(Debug)] - pub enum Variables {} - - impl Request for Variables { - type Arguments = VariablesArguments; - type Result = VariablesResponse; - const COMMAND: &'static str = "variables"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct StepInArguments { - pub thread_id: usize, - pub target_id: Option, - pub granularity: Option, - } - - #[derive(Debug)] - pub enum StepIn {} - - impl Request for StepIn { - type Arguments = StepInArguments; - type Result = (); - const COMMAND: &'static str = "stepIn"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct StepOutArguments { - pub thread_id: usize, - pub granularity: Option, - } - - #[derive(Debug)] - pub enum StepOut {} - - impl Request for StepOut { - type Arguments = StepOutArguments; - type Result = (); - const COMMAND: &'static str = "stepOut"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct NextArguments { - pub thread_id: usize, - pub granularity: Option, - } - - #[derive(Debug)] - pub enum Next {} - - impl Request for Next { - type Arguments = NextArguments; - type Result = (); - const COMMAND: &'static str = "next"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct PauseArguments { - pub thread_id: usize, - } - - #[derive(Debug)] - pub enum Pause {} - - impl Request for Pause { - type Arguments = PauseArguments; - type Result = (); - const COMMAND: &'static str = "pause"; - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct EvaluateArguments { - pub expression: String, - pub frame_id: Option, - pub context: Option, - pub format: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct EvaluateResponse { - pub result: String, - #[serde(rename = "type")] - pub data_type: Option, - pub presentation_hint: Option, - pub variables_reference: usize, - pub named_variables: Option, - pub indexed_variables: Option, - pub memory_reference: Option, - } - - #[derive(Debug)] - pub enum Evaluate {} - - impl Request for Evaluate { - type Arguments = EvaluateArguments; - type Result = EvaluateResponse; - const COMMAND: &'static str = "evaluate"; - } -} - -// Events - -pub mod events { - use super::*; - - #[derive(Debug, Clone, Serialize, Deserialize)] - #[serde(rename_all = "camelCase")] - #[serde(tag = "event", content = "body")] - // seq is omitted as unused and is not sent by some implementations - pub enum Event { - Initialized, - Stopped(Stopped), - Continued(Continued), - Exited(Exited), - Terminated(Terminated), - Thread(Thread), - Output(Output), - Breakpoint(Breakpoint), - Module(Module), - LoadedSource(LoadedSource), - Process(Process), - Capabilities(Capabilities), - // ProgressStart(), - // ProgressUpdate(), - // ProgressEnd(), - // Invalidated(), - Memory(Memory), - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Stopped { - pub reason: String, - pub description: Option, - pub thread_id: Option, - pub preserve_focus_hint: Option, - pub text: Option, - pub all_threads_stopped: Option, - pub hit_breakpoint_ids: Option>, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Continued { - pub thread_id: usize, - pub all_threads_continued: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Exited { - pub exit_code: usize, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Terminated { - pub restart: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Thread { - pub reason: String, - pub thread_id: usize, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Output { - pub output: String, - pub category: Option, - pub group: Option, - pub line: Option, - pub column: Option, - pub variables_reference: Option, - pub source: Option, - pub data: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Breakpoint { - pub reason: String, - pub breakpoint: super::Breakpoint, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Module { - pub reason: String, - pub module: super::Module, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct LoadedSource { - pub reason: String, - pub source: super::Source, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Process { - pub name: String, - pub system_process_id: Option, - pub is_local_process: Option, - pub start_method: String, // TODO: use enum - pub pointer_size: Option, - } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Capabilities { - pub module: super::DebuggerCapabilities, - } - - // #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - // #[serde(rename_all = "camelCase")] - // pub struct Invalidated { - // pub areas: Vec, - // pub thread_id: Option, - // pub stack_frame_id: Option, - // } - - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] - #[serde(rename_all = "camelCase")] - pub struct Memory { - pub memory_reference: String, - pub offset: usize, - pub count: usize, - } -} +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::path::PathBuf; + +pub trait Request { + type Arguments: serde::de::DeserializeOwned + serde::Serialize; + type Result: serde::de::DeserializeOwned + serde::Serialize; + const COMMAND: &'static str; +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ColumnDescriptor { + pub attribute_name: String, + pub label: String, + pub format: Option, + #[serde(rename = "type")] + pub col_type: Option, + pub width: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ExceptionBreakpointsFilter { + pub filter: String, + pub label: String, + pub description: Option, + pub default: Option, + pub supports_condition: Option, + pub condition_description: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DebuggerCapabilities { + pub supports_configuration_done_request: Option, + pub supports_function_breakpoints: Option, + pub supports_conditional_breakpoints: Option, + pub supports_hit_conditional_breakpoints: Option, + pub supports_evaluate_for_hovers: Option, + pub supports_step_back: Option, + pub supports_set_variable: Option, + pub supports_restart_frame: Option, + pub supports_goto_targets_request: Option, + pub supports_step_in_targets_request: Option, + pub supports_completions_request: Option, + pub supports_modules_request: Option, + pub supports_restart_request: Option, + pub supports_exception_options: Option, + pub supports_value_formatting_options: Option, + pub supports_exception_info_request: Option, + pub support_terminate_debuggee: Option, + pub support_suspend_debuggee: Option, + pub supports_delayed_stack_trace_loading: Option, + pub supports_loaded_sources_request: Option, + pub supports_log_points: Option, + pub supports_terminate_threads_request: Option, + pub supports_set_expression: Option, + pub supports_terminate_request: Option, + pub supports_data_breakpoints: Option, + pub supports_read_memory_request: Option, + pub supports_write_memory_request: Option, + pub supports_disassemble_request: Option, + pub supports_cancel_request: Option, + pub supports_breakpoint_locations_request: Option, + pub supports_clipboard_context: Option, + pub supports_stepping_granularity: Option, + pub supports_instruction_breakpoints: Option, + pub supports_exception_filter_options: Option, + pub exception_breakpoint_filters: Option>, + pub completion_trigger_characters: Option>, + pub additional_module_columns: Option>, + pub supported_checksum_algorithms: Option>, +} + +impl std::ops::Deref for DebuggerCapabilities { + type Target = Option; + + fn deref(&self) -> &Self::Target { + &self.supports_exception_options + } +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Checksum { + pub algorithm: String, + pub checksum: String, +} + +#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Source { + 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, Default, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +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)] +#[serde(rename_all = "camelCase")] +pub struct Breakpoint { + pub id: Option, + pub verified: bool, + pub message: Option, + pub source: Option, + pub line: Option, + pub column: Option, + pub end_line: Option, + pub end_column: Option, + pub instruction_reference: Option, + pub offset: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct StackFrameFormat { + pub parameters: Option, + pub parameter_types: Option, + pub parameter_names: Option, + pub parameter_values: Option, + pub line: Option, + pub module: Option, + pub include_all: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct StackFrame { + pub id: usize, + pub name: String, + pub source: Option, + pub line: usize, + pub column: usize, + pub end_line: Option, + pub end_column: Option, + pub can_restart: Option, + pub instruction_pointer_reference: Option, + pub module_id: Option, + pub presentation_hint: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Thread { + pub id: usize, + pub name: String, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Scope { + pub name: String, + pub presentation_hint: Option, + pub variables_reference: usize, + pub named_variables: Option, + pub indexed_variables: Option, + pub expensive: bool, + pub source: Option, + pub line: Option, + pub column: Option, + pub end_line: Option, + pub end_column: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ValueFormat { + pub hex: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct VariablePresentationHint { + pub kind: Option, + pub attributes: Option>, + pub visibility: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Variable { + pub name: String, + pub value: String, + #[serde(rename = "type")] + pub data_type: Option, + pub presentation_hint: Option, + pub evaluate_name: Option, + pub variables_reference: usize, + pub named_variables: Option, + pub indexed_variables: Option, + pub memory_reference: Option, +} + +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Module { + pub id: String, // TODO: || number + pub name: String, + pub path: Option, + pub is_optimized: Option, + pub is_user_code: Option, + pub version: Option, + pub symbol_status: Option, + pub symbol_file_path: Option, + pub date_time_stamp: Option, + pub address_range: Option, +} + +pub mod requests { + use super::*; + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct InitializeArguments { + #[serde(rename = "clientID")] + pub client_id: Option, + pub client_name: Option, + #[serde(rename = "adapterID")] + pub adapter_id: String, + pub locale: Option, + #[serde(rename = "linesStartAt1")] + pub lines_start_at_one: Option, + #[serde(rename = "columnsStartAt1")] + pub columns_start_at_one: Option, + pub path_format: Option, + pub supports_variable_type: Option, + pub supports_variable_paging: Option, + pub supports_run_in_terminal_request: Option, + pub supports_memory_references: Option, + pub supports_progress_reporting: Option, + pub supports_invalidated_event: Option, + } + + #[derive(Debug)] + pub enum Initialize {} + + impl Request for Initialize { + type Arguments = InitializeArguments; + type Result = DebuggerCapabilities; + const COMMAND: &'static str = "initialize"; + } + + #[derive(Debug)] + pub enum Launch {} + + impl Request for Launch { + type Arguments = Value; + type Result = Value; + const COMMAND: &'static str = "launch"; + } + + #[derive(Debug)] + pub enum Attach {} + + impl Request for Attach { + type Arguments = Value; + type Result = Value; + const COMMAND: &'static str = "attach"; + } + + #[derive(Debug)] + pub enum Disconnect {} + + impl Request for Disconnect { + type Arguments = (); + type Result = (); + const COMMAND: &'static str = "disconnect"; + } + + #[derive(Debug)] + pub enum ConfigurationDone {} + + impl Request for ConfigurationDone { + type Arguments = (); + type Result = (); + const COMMAND: &'static str = "configurationDone"; + } + + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct SetBreakpointsArguments { + pub source: Source, + pub breakpoints: Option>, + // lines is deprecated + pub source_modified: Option, + } + + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct SetBreakpointsResponse { + pub breakpoints: Option>, + } + + #[derive(Debug)] + pub enum SetBreakpoints {} + + impl Request for SetBreakpoints { + type Arguments = SetBreakpointsArguments; + type Result = SetBreakpointsResponse; + const COMMAND: &'static str = "setBreakpoints"; + } + + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct ContinueArguments { + pub thread_id: usize, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct ContinueResponse { + pub all_threads_continued: Option, + } + + #[derive(Debug)] + pub enum Continue {} + + impl Request for Continue { + type Arguments = ContinueArguments; + type Result = ContinueResponse; + const COMMAND: &'static str = "continue"; + } + + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct StackTraceArguments { + pub thread_id: usize, + pub start_frame: Option, + pub levels: Option, + pub format: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct StackTraceResponse { + pub total_frames: Option, + pub stack_frames: Vec, + } + + #[derive(Debug)] + pub enum StackTrace {} + + impl Request for StackTrace { + type Arguments = StackTraceArguments; + type Result = StackTraceResponse; + const COMMAND: &'static str = "stackTrace"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct ThreadsResponse { + pub threads: Vec, + } + + #[derive(Debug)] + pub enum Threads {} + + impl Request for Threads { + type Arguments = (); + type Result = ThreadsResponse; + const COMMAND: &'static str = "threads"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct ScopesArguments { + pub frame_id: usize, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct ScopesResponse { + pub scopes: Vec, + } + + #[derive(Debug)] + pub enum Scopes {} + + impl Request for Scopes { + type Arguments = ScopesArguments; + type Result = ScopesResponse; + const COMMAND: &'static str = "scopes"; + } + + #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct VariablesArguments { + pub variables_reference: usize, + pub filter: Option, + pub start: Option, + pub count: Option, + pub format: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct VariablesResponse { + pub variables: Vec, + } + + #[derive(Debug)] + pub enum Variables {} + + impl Request for Variables { + type Arguments = VariablesArguments; + type Result = VariablesResponse; + const COMMAND: &'static str = "variables"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct StepInArguments { + pub thread_id: usize, + pub target_id: Option, + pub granularity: Option, + } + + #[derive(Debug)] + pub enum StepIn {} + + impl Request for StepIn { + type Arguments = StepInArguments; + type Result = (); + const COMMAND: &'static str = "stepIn"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct StepOutArguments { + pub thread_id: usize, + pub granularity: Option, + } + + #[derive(Debug)] + pub enum StepOut {} + + impl Request for StepOut { + type Arguments = StepOutArguments; + type Result = (); + const COMMAND: &'static str = "stepOut"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct NextArguments { + pub thread_id: usize, + pub granularity: Option, + } + + #[derive(Debug)] + pub enum Next {} + + impl Request for Next { + type Arguments = NextArguments; + type Result = (); + const COMMAND: &'static str = "next"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct PauseArguments { + pub thread_id: usize, + } + + #[derive(Debug)] + pub enum Pause {} + + impl Request for Pause { + type Arguments = PauseArguments; + type Result = (); + const COMMAND: &'static str = "pause"; + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct EvaluateArguments { + pub expression: String, + pub frame_id: Option, + pub context: Option, + pub format: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct EvaluateResponse { + pub result: String, + #[serde(rename = "type")] + pub data_type: Option, + pub presentation_hint: Option, + pub variables_reference: usize, + pub named_variables: Option, + pub indexed_variables: Option, + pub memory_reference: Option, + } + + #[derive(Debug)] + pub enum Evaluate {} + + impl Request for Evaluate { + type Arguments = EvaluateArguments; + type Result = EvaluateResponse; + const COMMAND: &'static str = "evaluate"; + } +} + +// Events + +pub mod events { + use super::*; + + #[derive(Debug, Clone, Serialize, Deserialize)] + #[serde(rename_all = "camelCase")] + #[serde(tag = "event", content = "body")] + // seq is omitted as unused and is not sent by some implementations + pub enum Event { + Initialized, + Stopped(Stopped), + Continued(Continued), + Exited(Exited), + Terminated(Terminated), + Thread(Thread), + Output(Output), + Breakpoint(Breakpoint), + Module(Module), + LoadedSource(LoadedSource), + Process(Process), + Capabilities(Capabilities), + // ProgressStart(), + // ProgressUpdate(), + // ProgressEnd(), + // Invalidated(), + Memory(Memory), + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Stopped { + pub reason: String, + pub description: Option, + pub thread_id: Option, + pub preserve_focus_hint: Option, + pub text: Option, + pub all_threads_stopped: Option, + pub hit_breakpoint_ids: Option>, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Continued { + pub thread_id: usize, + pub all_threads_continued: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Exited { + pub exit_code: usize, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Terminated { + pub restart: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Thread { + pub reason: String, + pub thread_id: usize, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Output { + pub output: String, + pub category: Option, + pub group: Option, + pub line: Option, + pub column: Option, + pub variables_reference: Option, + pub source: Option, + pub data: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Breakpoint { + pub reason: String, + pub breakpoint: super::Breakpoint, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Module { + pub reason: String, + pub module: super::Module, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct LoadedSource { + pub reason: String, + pub source: super::Source, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Process { + pub name: String, + pub system_process_id: Option, + pub is_local_process: Option, + pub start_method: String, // TODO: use enum + pub pointer_size: Option, + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Capabilities { + pub module: super::DebuggerCapabilities, + } + + // #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + // #[serde(rename_all = "camelCase")] + // pub struct Invalidated { + // pub areas: Vec, + // pub thread_id: Option, + // pub stack_frame_id: Option, + // } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Memory { + pub memory_reference: String, + pub offset: usize, + pub count: usize, + } +} -- cgit v1.2.3-70-g09d2