on master help sign in
Refactor types, add a Request trait
3a9e1c3Blaž Hrastnik
helix-dap/src/client.rs+14−14
@@ -3,8 +3,8 @@ use crate::{
3 types::*,
3 types::*,
4 Result,
4 Result,
5};
5};
6−use log::{error, info};
6+pub use log::{error, info};
7−use serde::{Deserialize, Serialize};
7+use serde::Serialize;
8use serde_json::{from_value, to_value, Value};
8use serde_json::{from_value, to_value, Value};
9use std::{
9use std::{
10 collections::HashMap,
10 collections::HashMap,
@@ -208,7 +208,7 @@ impl Client {
208 }
208 }
209
209
210 pub async fn initialize(&mut self, adapter_id: String) -> Result<()> {
210 pub async fn initialize(&mut self, adapter_id: String) -> Result<()> {
211− let args = InitializeArguments {
211+ let args = requests::InitializeArguments {
212 client_id: Some("hx".to_owned()),
212 client_id: Some("hx".to_owned()),
213 client_name: Some("helix".to_owned()),
213 client_name: Some("helix".to_owned()),
214 adapter_id,
214 adapter_id,
@@ -262,7 +262,7 @@ impl Client {
262 file: String,
262 file: String,
263 breakpoints: Vec<SourceBreakpoint>,
263 breakpoints: Vec<SourceBreakpoint>,
264 ) -> Result<Option<Vec<Breakpoint>>> {
264 ) -> Result<Option<Vec<Breakpoint>>> {
265− let args = SetBreakpointsArguments {
265+ let args = requests::SetBreakpointsArguments {
266 source: Source {
266 source: Source {
267 path: Some(file),
267 path: Some(file),
268 name: None,
268 name: None,
@@ -280,7 +280,7 @@ impl Client {
280 let response = self
280 let response = self
281 .request("setBreakpoints".to_owned(), to_value(args).ok())
281 .request("setBreakpoints".to_owned(), to_value(args).ok())
282 .await?;
282 .await?;
283− let body: Option<SetBreakpointsResponseBody> = from_value(response.body.unwrap()).ok();
283+ let body: Option<requests::SetBreakpointsResponse> = from_value(response.body.unwrap()).ok();
284
284
285 Ok(body.map(|b| b.breakpoints).unwrap())
285 Ok(body.map(|b| b.breakpoints).unwrap())
286 }
286 }
@@ -291,13 +291,13 @@ impl Client {
291 }
291 }
292
292
293 pub async fn continue_thread(&mut self, thread_id: usize) -> Result<Option<bool>> {
293 pub async fn continue_thread(&mut self, thread_id: usize) -> Result<Option<bool>> {
294− let args = ContinueArguments { thread_id };
294+ let args = requests::ContinueArguments { thread_id };
295
295
296 let response = self
296 let response = self
297 .request("continue".to_owned(), to_value(args).ok())
297 .request("continue".to_owned(), to_value(args).ok())
298 .await?;
298 .await?;
299
299
300− let body: Option<ContinueResponseBody> = from_value(response.body.unwrap()).ok();
300+ let body: Option<requests::ContinueResponse> = from_value(response.body.unwrap()).ok();
301
301
302 Ok(body.map(|b| b.all_threads_continued).unwrap())
302 Ok(body.map(|b| b.all_threads_continued).unwrap())
303 }
303 }
@@ -306,7 +306,7 @@ impl Client {
306 &mut self,
306 &mut self,
307 thread_id: usize,
307 thread_id: usize,
308 ) -> Result<(Vec<StackFrame>, Option<usize>)> {
308 ) -> Result<(Vec<StackFrame>, Option<usize>)> {
309− let args = StackTraceArguments {
309+ let args = requests::StackTraceArguments {
310 thread_id,
310 thread_id,
311 start_frame: None,
311 start_frame: None,
312 levels: None,
312 levels: None,
@@ -317,7 +317,7 @@ impl Client {
317 .request("stackTrace".to_owned(), to_value(args).ok())
317 .request("stackTrace".to_owned(), to_value(args).ok())
318 .await?;
318 .await?;
319
319
320− let body: StackTraceResponseBody = from_value(response.body.unwrap()).unwrap();
320+ let body: requests::StackTraceResponse = from_value(response.body.unwrap()).unwrap();
321
321
322 Ok((body.stack_frames, body.total_frames))
322 Ok((body.stack_frames, body.total_frames))
323 }
323 }
@@ -325,25 +325,25 @@ impl Client {
325 pub async fn threads(&mut self) -> Result<Vec<Thread>> {
325 pub async fn threads(&mut self) -> Result<Vec<Thread>> {
326 let response = self.request("threads".to_owned(), None).await?;
326 let response = self.request("threads".to_owned(), None).await?;
327
327
328− let body: ThreadsResponseBody = from_value(response.body.unwrap()).unwrap();
328+ let body: requests::ThreadsResponse = from_value(response.body.unwrap()).unwrap();
329
329
330 Ok(body.threads)
330 Ok(body.threads)
331 }
331 }
332
332
333 pub async fn scopes(&mut self, frame_id: usize) -> Result<Vec<Scope>> {
333 pub async fn scopes(&mut self, frame_id: usize) -> Result<Vec<Scope>> {
334− let args = ScopesArguments { frame_id };
334+ let args = requests::ScopesArguments { frame_id };
335
335
336 let response = self
336 let response = self
337 .request("scopes".to_owned(), to_value(args).ok())
337 .request("scopes".to_owned(), to_value(args).ok())
338 .await?;
338 .await?;
339
339
340− let body: ScopesResponseBody = from_value(response.body.unwrap()).unwrap();
340+ let body: requests::ScopesResponse = from_value(response.body.unwrap()).unwrap();
341
341
342 Ok(body.scopes)
342 Ok(body.scopes)
343 }
343 }
344
344
345 pub async fn variables(&mut self, variables_reference: usize) -> Result<Vec<Variable>> {
345 pub async fn variables(&mut self, variables_reference: usize) -> Result<Vec<Variable>> {
346− let args = VariablesArguments {
346+ let args = requests::VariablesArguments {
347 variables_reference,
347 variables_reference,
348 filter: None,
348 filter: None,
349 start: None,
349 start: None,
@@ -355,7 +355,7 @@ impl Client {
355 .request("variables".to_owned(), to_value(args).ok())
355 .request("variables".to_owned(), to_value(args).ok())
356 .await?;
356 .await?;
357
357
358− let body: VariablesResponseBody = from_value(response.body.unwrap()).unwrap();
358+ let body: requests::VariablesResponse = from_value(response.body.unwrap()).unwrap();
359
359
360 Ok(body.variables)
360 Ok(body.variables)
361 }
361 }
helix-dap/src/lib.rs+1−1
@@ -3,7 +3,7 @@ mod transport;
3mod types;
3mod types;
4
4
5pub use client::Client;
5pub use client::Client;
6−pub use transport::{Event, Payload, Request, Response, Transport};
6+pub use transport::{Event, Payload, Response, Transport};
7pub use types::*;
7pub use types::*;
8
8
9use thiserror::Error;
9use thiserror::Error;
helix-dap/src/types.rs+392−324
@@ -1,324 +1,392 @@
1−use serde::{Deserialize, Serialize};
1+use serde::{Deserialize, Serialize};
2−use serde_json::Value;
2+use serde_json::Value;
3−
3+
4+pub trait Request {
5+ type Arguments: serde::de::DeserializeOwned + serde::Serialize;
6+ type Result: serde::de::DeserializeOwned + serde::Serialize;
7+ const COMMAND: &'static str;
8+}
9+
4−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
10+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
5−#[serde(rename_all = "camelCase")]
11+#[serde(rename_all = "camelCase")]
6−pub struct ColumnDescriptor {
12+pub struct ColumnDescriptor {
7− pub attribute_name: String,
13+ pub attribute_name: String,
8− pub label: String,
14+ pub label: String,
9− pub format: Option<String>,
15+ pub format: Option<String>,
10− #[serde(rename = "type")]
16+ #[serde(rename = "type")]
11− pub col_type: Option<String>,
17+ pub col_type: Option<String>,
12− pub width: Option<usize>,
18+ pub width: Option<usize>,
13−}
19+}
14−
20+
15−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
21+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
16−#[serde(rename_all = "camelCase")]
22+#[serde(rename_all = "camelCase")]
17−pub struct ExceptionBreakpointsFilter {
23+pub struct ExceptionBreakpointsFilter {
18− pub filter: String,
24+ pub filter: String,
19− pub label: String,
25+ pub label: String,
20− pub description: Option<String>,
26+ pub description: Option<String>,
21− pub default: Option<bool>,
27+ pub default: Option<bool>,
22− pub supports_condition: Option<bool>,
28+ pub supports_condition: Option<bool>,
23− pub condition_description: Option<String>,
29+ pub condition_description: Option<String>,
24−}
30+}
25−
31+
26−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
32+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
27−#[serde(rename_all = "camelCase")]
33+#[serde(rename_all = "camelCase")]
28−pub struct DebuggerCapabilities {
34+pub struct DebuggerCapabilities {
29− pub supports_configuration_done_request: Option<bool>,
35+ pub supports_configuration_done_request: Option<bool>,
30− pub supports_function_breakpoints: Option<bool>,
36+ pub supports_function_breakpoints: Option<bool>,
31− pub supports_conditional_breakpoints: Option<bool>,
37+ pub supports_conditional_breakpoints: Option<bool>,
32− pub supports_hit_conditional_breakpoints: Option<bool>,
38+ pub supports_hit_conditional_breakpoints: Option<bool>,
33− pub supports_evaluate_for_hovers: Option<bool>,
39+ pub supports_evaluate_for_hovers: Option<bool>,
34− pub supports_step_back: Option<bool>,
40+ pub supports_step_back: Option<bool>,
35− pub supports_set_variable: Option<bool>,
41+ pub supports_set_variable: Option<bool>,
36− pub supports_restart_frame: Option<bool>,
42+ pub supports_restart_frame: Option<bool>,
37− pub supports_goto_targets_request: Option<bool>,
43+ pub supports_goto_targets_request: Option<bool>,
38− pub supports_step_in_targets_request: Option<bool>,
44+ pub supports_step_in_targets_request: Option<bool>,
39− pub supports_completions_request: Option<bool>,
45+ pub supports_completions_request: Option<bool>,
40− pub supports_modules_request: Option<bool>,
46+ pub supports_modules_request: Option<bool>,
41− pub supports_restart_request: Option<bool>,
47+ pub supports_restart_request: Option<bool>,
42− pub supports_exception_options: Option<bool>,
48+ pub supports_exception_options: Option<bool>,
43− pub supports_value_formatting_options: Option<bool>,
49+ pub supports_value_formatting_options: Option<bool>,
44− pub supports_exception_info_request: Option<bool>,
50+ pub supports_exception_info_request: Option<bool>,
45− pub support_terminate_debuggee: Option<bool>,
51+ pub support_terminate_debuggee: Option<bool>,
46− pub support_suspend_debuggee: Option<bool>,
52+ pub support_suspend_debuggee: Option<bool>,
47− pub supports_delayed_stack_trace_loading: Option<bool>,
53+ pub supports_delayed_stack_trace_loading: Option<bool>,
48− pub supports_loaded_sources_request: Option<bool>,
54+ pub supports_loaded_sources_request: Option<bool>,
49− pub supports_log_points: Option<bool>,
55+ pub supports_log_points: Option<bool>,
50− pub supports_terminate_threads_request: Option<bool>,
56+ pub supports_terminate_threads_request: Option<bool>,
51− pub supports_set_expression: Option<bool>,
57+ pub supports_set_expression: Option<bool>,
52− pub supports_terminate_request: Option<bool>,
58+ pub supports_terminate_request: Option<bool>,
53− pub supports_data_breakpoints: Option<bool>,
59+ pub supports_data_breakpoints: Option<bool>,
54− pub supports_read_memory_request: Option<bool>,
60+ pub supports_read_memory_request: Option<bool>,
55− pub supports_write_memory_request: Option<bool>,
61+ pub supports_write_memory_request: Option<bool>,
56− pub supports_disassemble_request: Option<bool>,
62+ pub supports_disassemble_request: Option<bool>,
57− pub supports_cancel_request: Option<bool>,
63+ pub supports_cancel_request: Option<bool>,
58− pub supports_breakpoint_locations_request: Option<bool>,
64+ pub supports_breakpoint_locations_request: Option<bool>,
59− pub supports_clipboard_context: Option<bool>,
65+ pub supports_clipboard_context: Option<bool>,
60− pub supports_stepping_granularity: Option<bool>,
66+ pub supports_stepping_granularity: Option<bool>,
61− pub supports_instruction_breakpoints: Option<bool>,
67+ pub supports_instruction_breakpoints: Option<bool>,
62− pub supports_exception_filter_options: Option<bool>,
68+ pub supports_exception_filter_options: Option<bool>,
63− pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>,
69+ pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>,
64− pub completion_trigger_characters: Option<Vec<String>>,
70+ pub completion_trigger_characters: Option<Vec<String>>,
65− pub additional_module_columns: Option<Vec<ColumnDescriptor>>,
71+ pub additional_module_columns: Option<Vec<ColumnDescriptor>>,
66− pub supported_checksum_algorithms: Option<Vec<String>>,
72+ pub supported_checksum_algorithms: Option<Vec<String>>,
67−}
73+}
68−
74+
69−impl std::ops::Deref for DebuggerCapabilities {
75+impl std::ops::Deref for DebuggerCapabilities {
70− type Target = Option<bool>;
76+ type Target = Option<bool>;
71−
77+
72− fn deref(&self) -> &Self::Target {
78+ fn deref(&self) -> &Self::Target {
73− &self.supports_exception_options
79+ &self.supports_exception_options
74− }
80+ }
75−}
81+}
76−
82+
77−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
83+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
78−#[serde(rename_all = "camelCase")]
84+#[serde(rename_all = "camelCase")]
79−pub struct InitializeArguments {
80− #[serde(rename = "clientID")]
81− pub client_id: Option<String>,
82− pub client_name: Option<String>,
83− #[serde(rename = "adapterID")]
84− pub adapter_id: String,
85− pub locale: Option<String>,
86− #[serde(rename = "linesStartAt1")]
87− pub lines_start_at_one: Option<bool>,
88− #[serde(rename = "columnsStartAt1")]
89− pub columns_start_at_one: Option<bool>,
90− pub path_format: Option<String>,
91− pub supports_variable_type: Option<bool>,
92− pub supports_variable_paging: Option<bool>,
93− pub supports_run_in_terminal_request: Option<bool>,
94− pub supports_memory_references: Option<bool>,
95− pub supports_progress_reporting: Option<bool>,
96− pub supports_invalidated_event: Option<bool>,
97−}
98−
99−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
100−#[serde(rename_all = "camelCase")]
101−pub struct Checksum {
85+pub struct Checksum {
102− pub algorithm: String,
86+ pub algorithm: String,
103− pub checksum: String,
87+ pub checksum: String,
104−}
88+}
105−
89+
106−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
90+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
107−#[serde(rename_all = "camelCase")]
91+#[serde(rename_all = "camelCase")]
108−pub struct Source {
92+pub struct Source {
109− pub name: Option<String>,
93+ pub name: Option<String>,
110− pub path: Option<String>,
94+ pub path: Option<String>,
111− pub source_reference: Option<usize>,
95+ pub source_reference: Option<usize>,
112− pub presentation_hint: Option<String>,
96+ pub presentation_hint: Option<String>,
113− pub origin: Option<String>,
97+ pub origin: Option<String>,
114− pub sources: Option<Vec<Source>>,
98+ pub sources: Option<Vec<Source>>,
115− pub adapter_data: Option<Value>,
99+ pub adapter_data: Option<Value>,
116− pub checksums: Option<Vec<Checksum>>,
100+ pub checksums: Option<Vec<Checksum>>,
117−}
101+}
118−
102+
119−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
103+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
120−#[serde(rename_all = "camelCase")]
104+#[serde(rename_all = "camelCase")]
121−pub struct SourceBreakpoint {
105+pub struct SourceBreakpoint {
122− pub line: usize,
106+ pub line: usize,
123− pub column: Option<usize>,
107+ pub column: Option<usize>,
124− pub condition: Option<String>,
108+ pub condition: Option<String>,
125− pub hit_condition: Option<String>,
109+ pub hit_condition: Option<String>,
126− pub log_message: Option<String>,
110+ pub log_message: Option<String>,
127−}
111+}
128−
112+
129−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
113+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
130−#[serde(rename_all = "camelCase")]
114+#[serde(rename_all = "camelCase")]
131−pub struct SetBreakpointsArguments {
132− pub source: Source,
133− pub breakpoints: Option<Vec<SourceBreakpoint>>,
134− // lines is deprecated
135− pub source_modified: Option<bool>,
136−}
137−
138−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
139−#[serde(rename_all = "camelCase")]
140−pub struct Breakpoint {
115+pub struct Breakpoint {
141− pub id: Option<usize>,
116+ pub id: Option<usize>,
142− pub verified: bool,
117+ pub verified: bool,
143− pub message: Option<String>,
118+ pub message: Option<String>,
144− pub source: Option<Source>,
119+ pub source: Option<Source>,
145− pub line: Option<usize>,
120+ pub line: Option<usize>,
146− pub column: Option<usize>,
121+ pub column: Option<usize>,
147− pub end_line: Option<usize>,
122+ pub end_line: Option<usize>,
148− pub end_column: Option<usize>,
123+ pub end_column: Option<usize>,
149− pub instruction_reference: Option<String>,
124+ pub instruction_reference: Option<String>,
150− pub offset: Option<usize>,
125+ pub offset: Option<usize>,
151−}
126+}
152−
127+
153−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
128+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
154−#[serde(rename_all = "camelCase")]
129+#[serde(rename_all = "camelCase")]
155−pub struct SetBreakpointsResponseBody {
156− pub breakpoints: Option<Vec<Breakpoint>>,
157−}
158−
159−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
160−#[serde(rename_all = "camelCase")]
161−pub struct ContinueArguments {
162− pub thread_id: usize,
163−}
164−
165−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
166−#[serde(rename_all = "camelCase")]
167−pub struct ContinueResponseBody {
168− pub all_threads_continued: Option<bool>,
169−}
170−
171−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
172−#[serde(rename_all = "camelCase")]
173−pub struct StackFrameFormat {
130+pub struct StackFrameFormat {
174− pub parameters: Option<bool>,
131+ pub parameters: Option<bool>,
175− pub parameter_types: Option<bool>,
132+ pub parameter_types: Option<bool>,
176− pub parameter_names: Option<bool>,
133+ pub parameter_names: Option<bool>,
177− pub parameter_values: Option<bool>,
134+ pub parameter_values: Option<bool>,
178− pub line: Option<bool>,
135+ pub line: Option<bool>,
179− pub module: Option<bool>,
136+ pub module: Option<bool>,
180− pub include_all: Option<bool>,
137+ pub include_all: Option<bool>,
181−}
138+}
182−
139+
183−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
140+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
184−#[serde(rename_all = "camelCase")]
141+#[serde(rename_all = "camelCase")]
185−pub struct StackTraceArguments {
186− pub thread_id: usize,
187− pub start_frame: Option<usize>,
188− pub levels: Option<usize>,
189− pub format: Option<StackFrameFormat>,
190−}
191−
192−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
193−#[serde(rename_all = "camelCase")]
194−pub struct StackFrame {
142+pub struct StackFrame {
195− pub id: usize,
143+ pub id: usize,
196− pub name: String,
144+ pub name: String,
197− pub source: Option<Source>,
145+ pub source: Option<Source>,
198− pub line: usize,
146+ pub line: usize,
199− pub column: usize,
147+ pub column: usize,
200− pub end_line: Option<usize>,
148+ pub end_line: Option<usize>,
201− pub end_column: Option<usize>,
149+ pub end_column: Option<usize>,
202− pub can_restart: Option<bool>,
150+ pub can_restart: Option<bool>,
203− pub instruction_pointer_reference: Option<String>,
151+ pub instruction_pointer_reference: Option<String>,
204− pub module_id: Option<Value>,
152+ pub module_id: Option<Value>,
205− pub presentation_hint: Option<String>,
153+ pub presentation_hint: Option<String>,
206−}
154+}
207−
155+
208−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
156+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
209−#[serde(rename_all = "camelCase")]
157+#[serde(rename_all = "camelCase")]
210−pub struct StackTraceResponseBody {
211− pub total_frames: Option<usize>,
212− pub stack_frames: Vec<StackFrame>,
213−}
214−
215−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
216−#[serde(rename_all = "camelCase")]
217−pub struct Thread {
158+pub struct Thread {
218− pub id: usize,
159+ pub id: usize,
219− pub name: String,
160+ pub name: String,
220−}
221−
222−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
223−#[serde(rename_all = "camelCase")]
224−pub struct ThreadsResponseBody {
225− pub threads: Vec<Thread>,
226−}
227−
228−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
229−#[serde(rename_all = "camelCase")]
230−pub struct ScopesArguments {
231− pub frame_id: usize,
232−}
161+}
233−
162+
234−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
163+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
235−#[serde(rename_all = "camelCase")]
164+#[serde(rename_all = "camelCase")]
236−pub struct Scope {
165+pub struct Scope {
237− pub name: String,
166+ pub name: String,
238− pub presentation_hint: Option<String>,
167+ pub presentation_hint: Option<String>,
239− pub variables_reference: usize,
168+ pub variables_reference: usize,
240− pub named_variables: Option<usize>,
169+ pub named_variables: Option<usize>,
241− pub indexed_variables: Option<usize>,
170+ pub indexed_variables: Option<usize>,
242− pub expensive: bool,
171+ pub expensive: bool,
243− pub source: Option<Source>,
172+ pub source: Option<Source>,
244− pub line: Option<usize>,
173+ pub line: Option<usize>,
245− pub column: Option<usize>,
174+ pub column: Option<usize>,
246− pub end_line: Option<usize>,
175+ pub end_line: Option<usize>,
247− pub end_column: Option<usize>,
176+ pub end_column: Option<usize>,
248−}
177+}
249−
178+
250−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
179+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
251−#[serde(rename_all = "camelCase")]
180+#[serde(rename_all = "camelCase")]
252−pub struct ScopesResponseBody {
253− pub scopes: Vec<Scope>,
254−}
255−
256−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
257−#[serde(rename_all = "camelCase")]
258−pub struct ValueFormat {
181+pub struct ValueFormat {
259− pub hex: Option<bool>,
182+ pub hex: Option<bool>,
260−}
183+}
261−
184+
262−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
185+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
263−#[serde(rename_all = "camelCase")]
186+#[serde(rename_all = "camelCase")]
264−pub struct VariablesArguments {
265− pub variables_reference: usize,
266− pub filter: Option<String>,
267− pub start: Option<usize>,
268− pub count: Option<usize>,
269− pub format: Option<ValueFormat>,
270−}
271−
272−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
273−#[serde(rename_all = "camelCase")]
274−pub struct VariablePresentationHint {
187+pub struct VariablePresentationHint {
275− pub kind: Option<String>,
188+ pub kind: Option<String>,
276− pub attributes: Option<Vec<String>>,
189+ pub attributes: Option<Vec<String>>,
277− pub visibility: Option<String>,
190+ pub visibility: Option<String>,
278−}
191+}
279−
192+
280−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
193+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
281−#[serde(rename_all = "camelCase")]
194+#[serde(rename_all = "camelCase")]
282−pub struct Variable {
195+pub struct Variable {
283− pub name: String,
196+ pub name: String,
284− pub value: String,
197+ pub value: String,
285− #[serde(rename = "type")]
198+ #[serde(rename = "type")]
286− pub data_type: Option<String>,
199+ pub data_type: Option<String>,
287− pub presentation_hint: Option<VariablePresentationHint>,
200+ pub presentation_hint: Option<VariablePresentationHint>,
288− pub evaluate_name: Option<String>,
201+ pub evaluate_name: Option<String>,
289− pub variables_reference: usize,
202+ pub variables_reference: usize,
290− pub named_variables: Option<usize>,
203+ pub named_variables: Option<usize>,
291− pub indexed_variables: Option<usize>,
204+ pub indexed_variables: Option<usize>,
292− pub memory_reference: Option<String>,
205+ pub memory_reference: Option<String>,
293−}
206+}
294−
207+
208+pub mod requests {
209+ use super::*;
295−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
210+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
296−#[serde(rename_all = "camelCase")]
211+ #[serde(rename_all = "camelCase")]
297−pub struct VariablesResponseBody {
212+ pub struct InitializeArguments {
213+ #[serde(rename = "clientID")]
214+ pub client_id: Option<String>,
215+ pub client_name: Option<String>,
216+ #[serde(rename = "adapterID")]
217+ pub adapter_id: String,
218+ pub locale: Option<String>,
219+ #[serde(rename = "linesStartAt1")]
220+ pub lines_start_at_one: Option<bool>,
221+ #[serde(rename = "columnsStartAt1")]
222+ pub columns_start_at_one: Option<bool>,
223+ pub path_format: Option<String>,
224+ pub supports_variable_type: Option<bool>,
225+ pub supports_variable_paging: Option<bool>,
226+ pub supports_run_in_terminal_request: Option<bool>,
227+ pub supports_memory_references: Option<bool>,
228+ pub supports_progress_reporting: Option<bool>,
229+ pub supports_invalidated_event: Option<bool>,
230+ }
231+
232+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
233+ #[serde(rename_all = "camelCase")]
234+ pub struct SetBreakpointsArguments {
235+ pub source: Source,
236+ pub breakpoints: Option<Vec<SourceBreakpoint>>,
237+ // lines is deprecated
238+ pub source_modified: Option<bool>,
239+ }
240+
241+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
242+ #[serde(rename_all = "camelCase")]
243+ pub struct SetBreakpointsResponse {
244+ pub breakpoints: Option<Vec<Breakpoint>>,
245+ }
246+
247+ #[derive(Debug)]
248+ pub enum SetBreakpoints {}
249+
250+ impl Request for SetBreakpoints {
251+ type Arguments = SetBreakpointsArguments;
252+ type Result = SetBreakpointsResponse;
253+ const COMMAND: &'static str = "setBreakpoints";
254+ }
255+
256+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
257+ #[serde(rename_all = "camelCase")]
258+ pub struct ContinueArguments {
259+ pub thread_id: usize,
260+ }
261+
262+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
263+ #[serde(rename_all = "camelCase")]
264+ pub struct ContinueResponse {
265+ pub all_threads_continued: Option<bool>,
266+ }
267+
268+ #[derive(Debug)]
269+ pub enum Continue {}
270+
271+ impl Request for Continue {
272+ type Arguments = ContinueArguments;
273+ type Result = ContinueResponse;
274+ const COMMAND: &'static str = "continue";
275+ }
276+
277+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
278+ #[serde(rename_all = "camelCase")]
279+ pub struct StackTraceArguments {
280+ pub thread_id: usize,
281+ pub start_frame: Option<usize>,
282+ pub levels: Option<usize>,
283+ pub format: Option<StackFrameFormat>,
284+ }
285+
286+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
287+ #[serde(rename_all = "camelCase")]
288+ pub struct StackTraceResponse {
289+ pub total_frames: Option<usize>,
290+ pub stack_frames: Vec<StackFrame>,
291+ }
292+
293+ #[derive(Debug)]
294+ pub enum StackTrace {}
295+
296+ impl Request for StackTrace {
297+ type Arguments = StackTraceArguments;
298+ type Result = StackTraceResponse;
299+ const COMMAND: &'static str = "stackTrace";
300+ }
301+
302+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
303+ #[serde(rename_all = "camelCase")]
304+ pub struct ThreadsResponse {
305+ pub threads: Vec<Thread>,
306+ }
307+
308+ #[derive(Debug)]
309+ pub enum Threads {}
310+
311+ impl Request for Threads {
312+ type Arguments = ();
313+ type Result = ThreadsResponse;
314+ const COMMAND: &'static str = "threads";
315+ }
316+
317+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
318+ #[serde(rename_all = "camelCase")]
319+ pub struct ScopesArguments {
320+ pub frame_id: usize,
321+ }
322+
323+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
324+ #[serde(rename_all = "camelCase")]
325+ pub struct ScopesResponse {
326+ pub scopes: Vec<Scope>,
327+ }
328+
329+ #[derive(Debug)]
330+ pub enum Scopes {}
331+
332+ impl Request for Scopes {
333+ type Arguments = ScopesArguments;
334+ type Result = ScopesResponse;
335+ const COMMAND: &'static str = "scopes";
336+ }
337+
338+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
339+ #[serde(rename_all = "camelCase")]
340+ pub struct VariablesArguments {
341+ pub variables_reference: usize,
342+ pub filter: Option<String>,
343+ pub start: Option<usize>,
344+ pub count: Option<usize>,
345+ pub format: Option<ValueFormat>,
346+ }
347+
348+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
349+ #[serde(rename_all = "camelCase")]
350+ pub struct VariablesResponse {
298− pub variables: Vec<Variable>,
351+ pub variables: Vec<Variable>,
352+ }
353+
354+ #[derive(Debug)]
355+ pub enum Variables {}
356+
357+ impl Request for Variables {
358+ type Arguments = VariablesArguments;
359+ type Result = VariablesResponse;
360+ const COMMAND: &'static str = "scopes";
299−}
361+ }
300−
362+}
363+
364+// Events
365+
366+pub mod events {
367+ use super::*;
301−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
368+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
302−#[serde(rename_all = "camelCase")]
369+ #[serde(rename_all = "camelCase")]
303−pub struct OutputEventBody {
370+ pub struct Output {
304− pub output: String,
371+ pub output: String,
305− pub category: Option<String>,
372+ pub category: Option<String>,
306− pub group: Option<String>,
373+ pub group: Option<String>,
307− pub line: Option<usize>,
374+ pub line: Option<usize>,
308− pub column: Option<usize>,
375+ pub column: Option<usize>,
309− pub variables_reference: Option<usize>,
376+ pub variables_reference: Option<usize>,
310− pub source: Option<Source>,
377+ pub source: Option<Source>,
311− pub data: Option<Value>,
378+ pub data: Option<Value>,
312−}
379+ }
313−
380+
314−#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
381+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
315−#[serde(rename_all = "camelCase")]
382+ #[serde(rename_all = "camelCase")]
316−pub struct StoppedEventBody {
383+ pub struct Stopped {
317− pub reason: String,
384+ pub reason: String,
318− pub description: Option<String>,
385+ pub description: Option<String>,
319− pub thread_id: Option<usize>,
386+ pub thread_id: Option<usize>,
320− pub preserve_focus_hint: Option<bool>,
387+ pub preserve_focus_hint: Option<bool>,
321− pub text: Option<String>,
388+ pub text: Option<String>,
322− pub all_threads_stopped: Option<bool>,
389+ pub all_threads_stopped: Option<bool>,
323− pub hit_breakpoint_ids: Option<Vec<usize>>,
390+ pub hit_breakpoint_ids: Option<Vec<usize>>,
391+ }
324−}
392+}