diff options
author | Blaž Hrastnik | 2021-08-16 04:22:54 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-08-20 04:43:54 +0000 |
commit | 2d1ae2e44ba81da8e6c8380e2ab8505672e45ede (patch) | |
tree | 369e0db8f4c6cdb9278e2a7e8b326844f485299c /helix-dap/src/client.rs | |
parent | 6225401e84794dd1bfa1218524d37a6cd55e9d4e (diff) |
dap: Split types off into types.rs
Diffstat (limited to 'helix-dap/src/client.rs')
-rw-r--r-- | helix-dap/src/client.rs | 323 |
1 files changed, 1 insertions, 322 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 333b18a0..a0133d7d 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -1,5 +1,6 @@ use crate::{ transport::{Event, Payload, Request, Response, Transport}, + types::*, Result, }; use log::{error, info}; @@ -29,328 +30,6 @@ use tokio::{ time, }; -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ColumnDescriptor { - pub attribute_name: String, - pub label: String, - pub format: Option<String>, - #[serde(rename = "type")] - pub col_type: Option<String>, - pub width: Option<usize>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ExceptionBreakpointsFilter { - pub filter: String, - pub label: String, - pub description: Option<String>, - pub default: Option<bool>, - pub supports_condition: Option<bool>, - pub condition_description: Option<String>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct DebuggerCapabilities { - pub supports_configuration_done_request: Option<bool>, - pub supports_function_breakpoints: Option<bool>, - pub supports_conditional_breakpoints: Option<bool>, - pub supports_hit_conditional_breakpoints: Option<bool>, - pub supports_evaluate_for_hovers: Option<bool>, - pub supports_step_back: Option<bool>, - pub supports_set_variable: Option<bool>, - pub supports_restart_frame: Option<bool>, - pub supports_goto_targets_request: Option<bool>, - pub supports_step_in_targets_request: Option<bool>, - pub supports_completions_request: Option<bool>, - pub supports_modules_request: Option<bool>, - pub supports_restart_request: Option<bool>, - pub supports_exception_options: Option<bool>, - pub supports_value_formatting_options: Option<bool>, - pub supports_exception_info_request: Option<bool>, - pub support_terminate_debuggee: Option<bool>, - pub support_suspend_debuggee: Option<bool>, - pub supports_delayed_stack_trace_loading: Option<bool>, - pub supports_loaded_sources_request: Option<bool>, - pub supports_log_points: Option<bool>, - pub supports_terminate_threads_request: Option<bool>, - pub supports_set_expression: Option<bool>, - pub supports_terminate_request: Option<bool>, - pub supports_data_breakpoints: Option<bool>, - pub supports_read_memory_request: Option<bool>, - pub supports_write_memory_request: Option<bool>, - pub supports_disassemble_request: Option<bool>, - pub supports_cancel_request: Option<bool>, - pub supports_breakpoint_locations_request: Option<bool>, - pub supports_clipboard_context: Option<bool>, - pub supports_stepping_granularity: Option<bool>, - pub supports_instruction_breakpoints: Option<bool>, - pub supports_exception_filter_options: Option<bool>, - pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>, - pub completion_trigger_characters: Option<Vec<String>>, - pub additional_module_columns: Option<Vec<ColumnDescriptor>>, - pub supported_checksum_algorithms: Option<Vec<String>>, -} - -impl std::ops::Deref for DebuggerCapabilities { - type Target = Option<bool>; - - fn deref(&self) -> &Self::Target { - &self.supports_exception_options - } -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct InitializeArguments { - #[serde(rename = "clientID")] - client_id: Option<String>, - client_name: Option<String>, - #[serde(rename = "adapterID")] - adapter_id: String, - locale: Option<String>, - #[serde(rename = "linesStartAt1")] - lines_start_at_one: Option<bool>, - #[serde(rename = "columnsStartAt1")] - columns_start_at_one: Option<bool>, - path_format: Option<String>, - supports_variable_type: Option<bool>, - supports_variable_paging: Option<bool>, - supports_run_in_terminal_request: Option<bool>, - supports_memory_references: Option<bool>, - supports_progress_reporting: Option<bool>, - supports_invalidated_event: Option<bool>, -} - -#[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 { - 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)] -#[serde(rename_all = "camelCase")] -pub struct SourceBreakpoint { - pub line: 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)] -#[serde(rename_all = "camelCase")] -struct SetBreakpointsArguments { - source: Source, - breakpoints: Option<Vec<SourceBreakpoint>>, - // lines is deprecated - source_modified: Option<bool>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Breakpoint { - pub id: Option<usize>, - pub verified: bool, - pub message: Option<String>, - pub source: Option<Source>, - pub line: Option<usize>, - pub column: Option<usize>, - pub end_line: Option<usize>, - pub end_column: Option<usize>, - pub instruction_reference: Option<String>, - pub offset: Option<usize>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct SetBreakpointsResponseBody { - breakpoints: Option<Vec<Breakpoint>>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct ContinueArguments { - thread_id: usize, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct ContinueResponseBody { - all_threads_continued: Option<bool>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct StackFrameFormat { - parameters: Option<bool>, - parameter_types: Option<bool>, - parameter_names: Option<bool>, - parameter_values: Option<bool>, - line: Option<bool>, - module: Option<bool>, - include_all: Option<bool>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct StackTraceArguments { - thread_id: usize, - start_frame: Option<usize>, - levels: Option<usize>, - format: Option<StackFrameFormat>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct StackFrame { - pub id: usize, - pub name: String, - pub source: Option<Source>, - pub line: usize, - pub column: usize, - pub end_line: Option<usize>, - pub end_column: Option<usize>, - pub can_restart: Option<bool>, - pub instruction_pointer_reference: Option<String>, - pub module_id: Option<Value>, - pub presentation_hint: Option<String>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct StackTraceResponseBody { - total_frames: Option<usize>, - stack_frames: Vec<StackFrame>, -} - -#[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")] -struct ThreadsResponseBody { - threads: Vec<Thread>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct ScopesArguments { - frame_id: usize, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Scope { - pub name: String, - pub presentation_hint: Option<String>, - pub variables_reference: usize, - pub named_variables: Option<usize>, - pub indexed_variables: Option<usize>, - pub expensive: bool, - pub source: Option<Source>, - pub line: Option<usize>, - pub column: Option<usize>, - pub end_line: Option<usize>, - pub end_column: Option<usize>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct ScopesResponseBody { - scopes: Vec<Scope>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct ValueFormat { - hex: Option<bool>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct VariablesArguments { - variables_reference: usize, - filter: Option<String>, - start: Option<usize>, - count: Option<usize>, - format: Option<ValueFormat>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct VariablePresentationHint { - pub kind: Option<String>, - pub attributes: Option<Vec<String>>, - pub visibility: Option<String>, -} - -#[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<String>, - pub presentation_hint: Option<VariablePresentationHint>, - pub evaluate_name: Option<String>, - pub variables_reference: usize, - pub named_variables: Option<usize>, - pub indexed_variables: Option<usize>, - pub memory_reference: Option<String>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -struct VariablesResponseBody { - variables: Vec<Variable>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct OutputEventBody { - pub output: String, - pub category: Option<String>, - pub group: Option<String>, - pub line: Option<usize>, - pub column: Option<usize>, - pub variables_reference: Option<usize>, - pub source: Option<Source>, - pub data: Option<Value>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct StoppedEventBody { - pub reason: String, - pub description: Option<String>, - pub thread_id: Option<usize>, - pub preserve_focus_hint: Option<bool>, - pub text: Option<String>, - pub all_threads_stopped: Option<bool>, - pub hit_breakpoint_ids: Option<Vec<usize>>, -} - #[derive(Debug)] pub struct Client { id: usize, |