dap/types.rs
1use std::collections::HashMap;
2
3#[cfg(feature = "integration_testing")]
4use fake::{Dummy, Fake, Faker};
5#[cfg(feature = "integration_testing")]
6use rand::Rng;
7use serde::{Deserialize, Serialize};
8use serde_json::Value;
9
10#[derive(Deserialize, Serialize, Debug, Default, Clone)]
11#[serde(rename_all = "camelCase")]
12#[cfg_attr(feature = "integration_testing", derive(Dummy))]
13pub struct ExceptionBreakpointsFilter {
14 /// The internal ID of the filter option. This value is passed to the
15 /// `setExceptionBreakpoints` request.
16 pub filter: String,
17 /// The name of the filter option. This is shown in the UI.
18 pub label: String,
19 /// A help text providing additional information about the exception filter.
20 /// This string is typically shown as a hover and can be translated.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub description: Option<String>,
23 /// Initial value of the filter option. If not specified a value false is
24 /// assumed.
25 #[serde(skip_serializing_if = "Option::is_none")]
26 pub default: Option<bool>,
27 /// Controls whether a condition can be specified for this filter option. If
28 /// false or missing, a condition can not be set.
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub supports_condition: Option<bool>,
31 /// A help text providing information about the condition. This string is shown
32 /// as the placeholder text for a text box and can be translated.
33 #[serde(skip_serializing_if = "Option::is_none")]
34 pub condition_description: Option<String>,
35}
36
37#[derive(Deserialize, Serialize, Debug, Clone)]
38#[serde(rename_all = "camelCase")]
39#[cfg_attr(feature = "integration_testing", derive(Dummy))]
40pub enum ColumnDescriptorType {
41 String,
42 Number,
43 Boolean,
44 UnixTimestampUTC,
45}
46
47#[derive(Deserialize, Serialize, Debug, Default, Clone)]
48#[serde(rename_all = "camelCase")]
49#[cfg_attr(feature = "integration_testing", derive(Dummy))]
50pub struct ColumnDescriptor {
51 /// Name of the attribute rendered in this column.
52 pub attribute_name: String,
53 /// Header UI label of column.
54 pub label: String,
55 /// Format to use for the rendered values in this column. TBD how the format
56 /// strings looks like.
57 pub format: String,
58 /// Datatype of values in this column. Defaults to `string` if not specified.
59 /// Values: 'string', 'number', 'bool', 'unixTimestampUTC'
60 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
61 pub column_descriptor_type: Option<ColumnDescriptorType>,
62 /// Width of this column in characters (hint only).
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub width: Option<i64>,
65}
66
67#[derive(Deserialize, Serialize, Debug, Clone)]
68#[cfg_attr(feature = "integration_testing", derive(Dummy))]
69pub enum ChecksumAlgorithm {
70 MD5,
71 SHA1,
72 SHA256,
73 #[serde(rename = "timestamp")]
74 Timestamp,
75}
76
77#[derive(Deserialize, Serialize, Debug, Default, Clone)]
78#[serde(rename_all = "camelCase")]
79#[cfg_attr(feature = "integration_testing", derive(Dummy))]
80pub struct Capabilities {
81 /// The debug adapter supports the `configurationDone` request.
82 #[serde(skip_serializing_if = "Option::is_none")]
83 pub supports_configuration_done_request: Option<bool>,
84 /// The debug adapter supports function breakpoints.
85 #[serde(skip_serializing_if = "Option::is_none")]
86 pub supports_function_breakpoints: Option<bool>,
87 /// The debug adapter supports conditional breakpoints.
88 #[serde(skip_serializing_if = "Option::is_none")]
89 pub supports_conditional_breakpoints: Option<bool>,
90 /// The debug adapter supports breakpoints that break execution after a
91 /// specified i64 of hits.
92 #[serde(skip_serializing_if = "Option::is_none")]
93 pub supports_hit_conditional_breakpoints: Option<bool>,
94 /// The debug adapter supports a (side effect free) `evaluate` request for data
95 /// hovers.
96 #[serde(skip_serializing_if = "Option::is_none")]
97 pub supports_evaluate_for_hovers: Option<bool>,
98 /// Available exception filter options for the `setExceptionBreakpoints`
99 /// request.
100 #[serde(skip_serializing_if = "Option::is_none")]
101 pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>,
102 /// The debug adapter supports stepping back via the `stepBack` and
103 /// `reverseContinue` requests.
104 #[serde(skip_serializing_if = "Option::is_none")]
105 pub supports_step_back: Option<bool>,
106 /// The debug adapter supports setting a variable to a value.
107 #[serde(skip_serializing_if = "Option::is_none")]
108 pub supports_set_variable: Option<bool>,
109 /// The debug adapter supports restarting a frame.
110 #[serde(skip_serializing_if = "Option::is_none")]
111 pub supports_restart_frame: Option<bool>,
112 /// The debug adapter supports the `gotoTargets` request.
113 #[serde(skip_serializing_if = "Option::is_none")]
114 pub supports_goto_targets_request: Option<bool>,
115 /// The debug adapter supports the `stepInTargets` request.
116 #[serde(skip_serializing_if = "Option::is_none")]
117 pub supports_step_in_targets_request: Option<bool>,
118 /// The debug adapter supports the `completions` request.
119 #[serde(skip_serializing_if = "Option::is_none")]
120 pub supports_completions_request: Option<bool>,
121 /// The set of characters that should trigger completion in a REPL. If not
122 /// specified, the UI should assume the `.` character.
123 #[serde(skip_serializing_if = "Option::is_none")]
124 pub completion_trigger_characters: Option<Vec<String>>,
125 /// The debug adapter supports the `modules` request.
126 #[serde(skip_serializing_if = "Option::is_none")]
127 pub supports_modules_request: Option<bool>,
128 /// The set of additional module information exposed by the debug adapter.
129 #[serde(skip_serializing_if = "Option::is_none")]
130 pub additional_module_columns: Option<Vec<ColumnDescriptor>>,
131 /// Checksum algorithms supported by the debug adapter.
132 #[serde(skip_serializing_if = "Option::is_none")]
133 pub supported_checksum_algorithms: Option<Vec<ChecksumAlgorithm>>,
134 /// The debug adapter supports the `restart` request. In this case a client
135 /// should not implement `restart` by terminating and relaunching the adapter
136 /// but by calling the `restart` request.
137 #[serde(skip_serializing_if = "Option::is_none")]
138 pub supports_restart_request: Option<bool>,
139 /// The debug adapter supports `exceptionOptions` on the
140 /// `setExceptionBreakpoints` request.
141 #[serde(skip_serializing_if = "Option::is_none")]
142 pub supports_exception_options: Option<bool>,
143 /// The debug adapter supports a `format` attribute on the `stackTrace`,
144 /// `variables`, and `evaluate` requests.
145 #[serde(skip_serializing_if = "Option::is_none")]
146 pub supports_value_formatting_options: Option<bool>,
147 /// The debug adapter supports the `exceptionInfo` request.
148 #[serde(skip_serializing_if = "Option::is_none")]
149 pub supports_exception_info_request: Option<bool>,
150 /// The debug adapter supports the `terminateDebuggee` attribute on the
151 /// `disconnect` request.
152 #[serde(skip_serializing_if = "Option::is_none")]
153 pub support_terminate_debuggee: Option<bool>,
154 /// The debug adapter supports the `suspendDebuggee` attribute on the
155 /// `disconnect` request.
156 #[serde(skip_serializing_if = "Option::is_none")]
157 pub support_suspend_debuggee: Option<bool>,
158 /// The debug adapter supports the delayed loading of parts of the stack, which
159 /// requires that both the `startFrame` and `levels` arguments and the
160 /// `totalFrames` result of the `stackTrace` request are supported.
161 #[serde(skip_serializing_if = "Option::is_none")]
162 pub supports_delayed_stack_trace_loading: Option<bool>,
163 /// The debug adapter supports the `loadedSources` request.
164 #[serde(skip_serializing_if = "Option::is_none")]
165 pub supports_loaded_sources_request: Option<bool>,
166 /// The debug adapter supports log points by interpreting the `logMessage`
167 /// attribute of the `SourceBreakpoint`.
168 #[serde(skip_serializing_if = "Option::is_none")]
169 pub supports_log_points: Option<bool>,
170 /// The debug adapter supports the `terminateThreads` request.
171 #[serde(skip_serializing_if = "Option::is_none")]
172 pub supports_terminate_threads_request: Option<bool>,
173 /// The debug adapter supports the `setExpression` request.
174 #[serde(skip_serializing_if = "Option::is_none")]
175 pub supports_set_expression: Option<bool>,
176 /// The debug adapter supports the `terminate` request.
177 #[serde(skip_serializing_if = "Option::is_none")]
178 pub supports_terminate_request: Option<bool>,
179 /// The debug adapter supports data breakpoints.
180 #[serde(skip_serializing_if = "Option::is_none")]
181 pub supports_data_breakpoints: Option<bool>,
182 /// The debug adapter supports the `readMemory` request.
183 #[serde(skip_serializing_if = "Option::is_none")]
184 pub supports_read_memory_request: Option<bool>,
185 /// The debug adapter supports the `writeMemory` request.
186 #[serde(skip_serializing_if = "Option::is_none")]
187 pub supports_write_memory_request: Option<bool>,
188 /// The debug adapter supports the `disassemble` request.
189 #[serde(skip_serializing_if = "Option::is_none")]
190 pub supports_disassemble_request: Option<bool>,
191 /// The debug adapter supports the `cancel` request.
192 #[serde(skip_serializing_if = "Option::is_none")]
193 pub supports_cancel_request: Option<bool>,
194 /// The debug adapter supports the `breakpointLocations` request.
195 #[serde(skip_serializing_if = "Option::is_none")]
196 pub supports_breakpoint_locations_request: Option<bool>,
197 /// The debug adapter supports the `clipboard` context value in the `evaluate`
198 /// request.
199 #[serde(skip_serializing_if = "Option::is_none")]
200 pub supports_clipboard_context: Option<bool>,
201 /// The debug adapter supports stepping granularities (argument `granularity`)
202 /// for the stepping requests.
203 #[serde(skip_serializing_if = "Option::is_none")]
204 pub supports_stepping_granularity: Option<bool>,
205 /// The debug adapter supports adding breakpoints based on instruction
206 /// references.
207 #[serde(skip_serializing_if = "Option::is_none")]
208 pub supports_instruction_breakpoints: Option<bool>,
209 /// The debug adapter supports `filterOptions` as an argument on the
210 /// `setExceptionBreakpoints` request.
211 #[serde(skip_serializing_if = "Option::is_none")]
212 pub supports_exception_filter_options: Option<bool>,
213 /// The debug adapter supports the `singleThread` property on the execution
214 /// requests (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`,
215 /// `stepBack`).
216 #[serde(skip_serializing_if = "Option::is_none")]
217 pub supports_single_thread_execution_requests: Option<bool>,
218}
219
220#[derive(Deserialize, Serialize, Debug, Default, Clone)]
221pub struct CustomValue(pub Value);
222
223#[cfg(feature = "integration_testing")]
224struct ValueFaker;
225
226#[cfg(feature = "integration_testing")]
227impl Dummy<ValueFaker> for CustomValue {
228 fn dummy_with_rng<R: Rng + ?Sized>(_: &ValueFaker, rng: &mut R) -> Self {
229 CustomValue(match rng.gen_range(0..=5) {
230 1 => Value::Bool(rng.r#gen()),
231 2 => Value::Number(serde_json::Number::from_f64(rng.r#gen()).unwrap()),
232 3 => Value::String(Faker.fake::<String>()),
233 _ => Value::Null,
234 })
235 }
236}
237
238/// A Source is a descriptor for source code.
239///
240/// It is returned from the debug adapter as part of a StackFrame and it is used by clients when
241/// specifying breakpoints.
242///
243/// Specification: [Source](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source)
244#[derive(Deserialize, Serialize, Debug, Default, Clone)]
245#[serde(rename_all = "camelCase")]
246#[cfg_attr(feature = "integration_testing", derive(Dummy))]
247pub struct Source {
248 /// The short name of the source. Every source returned from the debug adapter
249 /// has a name.
250 /// When sending a source to the debug adapter this name is optional.
251 #[serde(skip_serializing_if = "Option::is_none")]
252 pub name: Option<String>,
253 /// The path of the source to be shown in the UI.
254 /// It is only used to locate and load the content of the source if no
255 /// `sourceReference` is specified (or its value is 0).
256 #[serde(skip_serializing_if = "Option::is_none")]
257 pub path: Option<String>,
258 /// If the value > 0 the contents of the source must be retrieved through the
259 /// `source` request (even if a path is specified).
260 /// Since a `sourceReference` is only valid for a session, it can not be used
261 /// to persist a source.
262 /// The value should be less than or equal to 2147483647 (2^31-1).
263 #[serde(skip_serializing_if = "Option::is_none")]
264 pub source_reference: Option<i32>,
265 /// A hint for how to present the source in the UI.
266 /// A value of `deemphasize` can be used to indicate that the source is not
267 /// available or that it is skipped on stepping.
268 #[serde(skip_serializing_if = "Option::is_none")]
269 pub presentation_hint: Option<PresentationHint>,
270 /// The origin of this source. For example, 'internal module', 'inlined content
271 /// from source map', etc.
272 #[serde(skip_serializing_if = "Option::is_none")]
273 pub origin: Option<String>,
274 /// A list of sources that are related to this source. These may be the source
275 /// that generated this source.
276 #[serde(skip_serializing_if = "Option::is_none")]
277 pub sources: Option<Vec<Source>>,
278 /// Additional data that a debug adapter might want to loop through the client.
279 /// The client should leave the data intact and persist it across sessions. The
280 /// client should not interpret the data.
281 #[cfg_attr(feature = "integration_testing", dummy(faker = "ValueFaker"))]
282 #[serde(skip_serializing_if = "Option::is_none")]
283 pub adapter_data: Option<CustomValue>,
284 /// The checksums associated with this file.
285 #[serde(skip_serializing_if = "Option::is_none")]
286 pub checksums: Option<Vec<Checksum>>,
287}
288
289#[derive(Deserialize, Serialize, Debug, Default, Clone)]
290#[serde(rename_all = "camelCase")]
291#[cfg_attr(feature = "integration_testing", derive(Dummy))]
292pub struct SourceBreakpoint {
293 /// The source line of the breakpoint or logpoint.
294 pub line: i64,
295 /// Start position within source line of the breakpoint or logpoint. It is
296 /// measured in UTF-16 code units and the client capability `columnsStartAt1`
297 /// determines whether it is 0- or 1-based.
298 #[serde(skip_serializing_if = "Option::is_none")]
299 pub column: Option<i64>,
300 /// The expression for conditional breakpoints.
301 /// It is only honored by a debug adapter if the corresponding capability
302 /// `supportsConditionalBreakpoints` is true.
303 #[serde(skip_serializing_if = "Option::is_none")]
304 pub condition: Option<String>,
305 /// The expression that controls how many hits of the breakpoint are ignored.
306 /// The debug adapter is expected to interpret the expression as needed.
307 /// The attribute is only honored by a debug adapter if the corresponding
308 /// capability `supportsHitConditionalBreakpoints` is true.
309 #[serde(skip_serializing_if = "Option::is_none")]
310 pub hit_condition: Option<String>,
311 /// If this attribute exists and is non-empty, the debug adapter must not
312 /// 'break' (stop)
313 /// but log the message instead. Expressions within `{}` are interpolated.
314 /// The attribute is only honored by a debug adapter if the corresponding
315 /// capability `supportsLogPoints` is true.
316 #[serde(skip_serializing_if = "Option::is_none")]
317 pub log_message: Option<String>,
318}
319
320/// Information about a breakpoint created in setBreakpoints, setFunctionBreakpoints,
321/// setInstructionBreakpoints, or setDataBreakpoints requests.
322#[derive(Deserialize, Serialize, Debug, Default, Clone)]
323#[serde(rename_all = "camelCase")]
324#[cfg_attr(feature = "integration_testing", derive(Dummy))]
325pub struct Breakpoint {
326 /// The identifier for the breakpoint. It is needed if breakpoint events are
327 /// used to update or remove breakpoints.
328 #[serde(skip_serializing_if = "Option::is_none")]
329 pub id: Option<i64>,
330 /// If true, the breakpoint could be set (but not necessarily at the desired
331 /// location).
332 pub verified: bool,
333 /// A message about the state of the breakpoint.
334 /// This is shown to the user and can be used to explain why a breakpoint could
335 /// not be verified.
336 #[serde(skip_serializing_if = "Option::is_none")]
337 pub message: Option<String>,
338 /// The source where the breakpoint is located.
339 #[serde(skip_serializing_if = "Option::is_none")]
340 pub source: Option<Source>,
341 /// The start line of the actual range covered by the breakpoint.
342 #[serde(skip_serializing_if = "Option::is_none")]
343 pub line: Option<i64>,
344 /// Start position of the source range covered by the breakpoint. It is
345 /// measured in UTF-16 code units and the client capability `columnsStartAt1`
346 /// determines whether it is 0- or 1-based.
347 #[serde(skip_serializing_if = "Option::is_none")]
348 pub column: Option<i64>,
349 /// The end line of the actual range covered by the breakpoint.
350 #[serde(skip_serializing_if = "Option::is_none")]
351 pub end_line: Option<i64>,
352 /// End position of the source range covered by the breakpoint. It is measured
353 /// in UTF-16 code units and the client capability `columnsStartAt1` determines
354 /// whether it is 0- or 1-based.
355 /// If no end line is given, then the end column is assumed to be in the start
356 /// line.
357 #[serde(skip_serializing_if = "Option::is_none")]
358 pub end_column: Option<i64>,
359 /// A memory reference to where the breakpoint is set.
360 #[serde(skip_serializing_if = "Option::is_none")]
361 pub instruction_reference: Option<String>,
362 /// The offset from the instruction reference.
363 /// This can be negative.
364 #[serde(skip_serializing_if = "Option::is_none")]
365 pub offset: Option<i64>,
366}
367
368#[derive(Deserialize, Serialize, Debug, Clone)]
369#[serde(rename_all = "camelCase")]
370#[cfg_attr(feature = "integration_testing", derive(Dummy))]
371pub enum PresentationHint {
372 Normal,
373 Emphasize,
374 DeEmphasize,
375}
376
377#[derive(Deserialize, Serialize, Debug, Clone)]
378#[serde(rename_all = "camelCase")]
379#[cfg_attr(feature = "integration_testing", derive(Dummy))]
380pub struct Checksum {
381 /// The algorithm used to calculate this checksum.
382 pub algorithm: ChecksumAlgorithm,
383 /// Value of the checksum, encoded as a hexadecimal value.
384 pub checksum: String,
385}
386
387/// An ExceptionFilterOptions is used to specify an exception filter together with a condition for
388/// the setExceptionBreakpoints request.
389#[derive(Deserialize, Serialize, Debug, Default, Clone)]
390#[serde(rename_all = "camelCase")]
391#[cfg_attr(feature = "integration_testing", derive(Dummy))]
392pub struct ExceptionFilterOptions {
393 /// ID of an exception filter returned by the `exceptionBreakpointFilters`
394 /// capability.
395 pub filter_id: String,
396 /// An expression for conditional exceptions.
397 /// The exception breaks into the debugger if the result of the condition is
398 /// true.
399 #[serde(skip_serializing_if = "Option::is_none")]
400 pub condition: Option<String>,
401}
402
403/// This enumeration defines all possible conditions when a thrown exception should result in a
404/// break.
405///
406/// Specification: [`ExceptionBreakMode`](https://microsoft.github.io/debug-adapter-protocol/specification#Types_ExceptionBreakMode)
407#[derive(Deserialize, Serialize, Debug, Clone, Default)]
408#[serde(rename_all = "camelCase")]
409#[cfg_attr(feature = "integration_testing", derive(Dummy))]
410pub enum ExceptionBreakMode {
411 /// never breaks
412 #[default]
413 Never,
414 /// always breaks
415 Always,
416 /// breaks when exception unhandled
417 Unhandled,
418 /// breaks if the exception is not handled by user code
419 UserUnhandled,
420}
421
422/// An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in
423/// a tree of exceptions.
424/// If a segment consists of more than one name, it matches the names provided if negate is false
425/// or missing, or it matches anything except the names provided if negate is true.
426///
427/// Specification: [`ExceptionPathSegment`](https://microsoft.github.io/debug-adapter-protocol/specification#Types_ExceptionPathSegment)
428#[derive(Deserialize, Serialize, Debug, Default, Clone)]
429#[serde(rename_all = "camelCase")]
430#[cfg_attr(feature = "integration_testing", derive(Dummy))]
431pub struct ExceptionPathSegment {
432 /// If false or missing this segment matches the names provided, otherwise it
433 /// matches anything except the names provided.
434 #[serde(skip_serializing_if = "Option::is_none")]
435 pub negate: Option<bool>,
436 /// Depending on the value of `negate` the names that should match or not
437 /// match.
438 pub names: Vec<String>,
439}
440
441/// An ExceptionOptions assigns configuration options to a set of exceptions.
442///
443/// Specification: [`ExceptionOptions`](https://microsoft.github.io/debug-adapter-protocol/specification#Types_ExceptionOptions)
444#[derive(Deserialize, Serialize, Debug, Clone)]
445#[serde(rename_all = "camelCase")]
446#[cfg_attr(feature = "integration_testing", derive(Dummy))]
447pub struct ExceptionOptions {
448 /// A path that selects a single or multiple exceptions in a tree. If `path` is
449 /// missing, the whole tree is selected.
450 /// By convention the first segment of the path is a category that is used to
451 /// group exceptions in the UI.
452 #[serde(skip_serializing_if = "Option::is_none")]
453 pub path: Option<Vec<ExceptionPathSegment>>,
454 /// Condition when a thrown exception should result in a break.
455 pub break_mode: ExceptionBreakMode,
456}
457
458/// Properties of a breakpoint passed to the setFunctionBreakpoints request.
459///
460/// Specification: [FunctionBreakpoint](https://microsoft.github.io/debug-adapter-protocol/specification#Types_FunctionBreakpoint)
461#[derive(Deserialize, Serialize, Debug, Default, Clone)]
462#[serde(rename_all = "camelCase")]
463#[cfg_attr(feature = "integration_testing", derive(Dummy))]
464pub struct FunctionBreakpoint {
465 /// The name of the function.
466 pub name: String,
467 /// An expression for conditional breakpoints.
468 /// It is only honored by a debug adapter if the corresponding capability
469 /// `supportsConditionalBreakpoints` is true.
470 #[serde(skip_serializing_if = "Option::is_none")]
471 pub condition: Option<String>,
472 /// An expression that controls how many hits of the breakpoint are ignored.
473 /// The debug adapter is expected to interpret the expression as needed.
474 /// The attribute is only honored by a debug adapter if the corresponding
475 /// capability `supportsHitConditionalBreakpoints` is true.
476 #[serde(skip_serializing_if = "Option::is_none")]
477 pub hit_condition: Option<String>,
478}
479
480#[derive(Deserialize, Serialize, Debug, Clone)]
481#[serde(rename_all = "camelCase")]
482#[cfg_attr(feature = "integration_testing", derive(Dummy))]
483pub enum BreakpointEventReason {
484 Changed,
485 New,
486 Removed,
487 #[serde(untagged)]
488 String(String),
489}
490
491#[derive(Deserialize, Serialize, Debug, Clone)]
492#[serde(rename_all = "camelCase")]
493#[cfg_attr(feature = "integration_testing", derive(Dummy))]
494pub enum InvalidatedAreas {
495 All,
496 Stacks,
497 Threads,
498 Variables,
499 #[serde(untagged)]
500 String(String),
501}
502
503#[derive(Deserialize, Serialize, Debug, Clone)]
504#[serde(rename_all = "camelCase")]
505#[cfg_attr(feature = "integration_testing", derive(Dummy))]
506pub enum LoadedSourceEventReason {
507 New,
508 Changed,
509 Removed,
510}
511
512#[derive(Deserialize, Serialize, Debug, Clone)]
513#[serde(rename_all = "camelCase")]
514#[cfg_attr(feature = "integration_testing", derive(Dummy))]
515pub enum ModuleEventReason {
516 New,
517 Changed,
518 Removed,
519}
520
521#[derive(Deserialize, Serialize, Debug, Clone)]
522#[serde(rename_all = "camelCase")]
523#[cfg_attr(feature = "integration_testing", derive(Dummy))]
524pub struct Module {
525 /// Unique identifier for the module.
526 pub id: ModuleId,
527 /// A name of the module.
528 pub name: String,
529 /// Logical full path to the module. The exact definition is implementation
530 /// defined, but usually this would be a full path to the on-disk file for the
531 /// module.
532 #[serde(skip_serializing_if = "Option::is_none")]
533 pub path: Option<String>,
534 /// True if the module is optimized.
535 #[serde(skip_serializing_if = "Option::is_none")]
536 pub is_optimized: Option<bool>,
537 /// True if the module is considered 'user code' by a debugger that supports
538 /// 'Just My Code'.
539 #[serde(skip_serializing_if = "Option::is_none")]
540 pub is_user_code: Option<bool>,
541 /// Version of Module.
542 #[serde(skip_serializing_if = "Option::is_none")]
543 pub version: Option<String>,
544 /// User-understandable description of if symbols were found for the module
545 /// (ex: 'Symbols Loaded', 'Symbols not found', etc.)
546 #[serde(skip_serializing_if = "Option::is_none")]
547 pub symbol_status: Option<String>,
548 /// Logical full path to the symbol file. The exact definition is
549 /// implementation defined.
550 #[serde(skip_serializing_if = "Option::is_none")]
551 pub symbol_file_path: Option<String>,
552 /// Module created or modified, encoded as a RFC 3339 timestamp.
553 #[serde(skip_serializing_if = "Option::is_none")]
554 pub date_time_stamp: Option<String>,
555 /// Address range covered by this module.
556 #[serde(skip_serializing_if = "Option::is_none")]
557 pub address_range: Option<String>,
558}
559
560#[derive(Deserialize, Serialize, Debug, Clone)]
561#[serde(rename_all = "camelCase")]
562#[cfg_attr(feature = "integration_testing", derive(Dummy))]
563pub enum ModuleId {
564 Number,
565 #[serde(untagged)]
566 String(String),
567}
568
569#[derive(Deserialize, Serialize, Debug, Clone)]
570#[serde(rename_all = "camelCase")]
571#[cfg_attr(feature = "integration_testing", derive(Dummy))]
572pub enum OutputEventCategory {
573 Console,
574 Important,
575 Stdout,
576 Stderr,
577 Telemetry,
578 #[serde(untagged)]
579 String(String),
580}
581
582#[derive(Deserialize, Serialize, Debug, Clone)]
583#[serde(rename_all = "camelCase")]
584#[cfg_attr(feature = "integration_testing", derive(Dummy))]
585pub enum OutputEventGroup {
586 Start,
587 StartCollapsed,
588 End,
589}
590
591#[derive(Deserialize, Serialize, Debug, Clone)]
592#[serde(rename_all = "camelCase")]
593#[cfg_attr(feature = "integration_testing", derive(Dummy))]
594pub enum ProcessEventStartMethod {
595 Launch,
596 Attach,
597 AttachForSuspendedLaunch,
598}
599
600#[derive(Deserialize, Serialize, Debug, Clone)]
601#[serde(rename_all = "camelCase")]
602#[cfg_attr(feature = "integration_testing", derive(Dummy))]
603pub enum StoppedEventReason {
604 Step,
605 Breakpoint,
606 Exception,
607 Pause,
608 Entry,
609 Goto,
610 Function,
611 Data,
612 Instruction,
613 #[serde(untagged)]
614 String(String),
615}
616
617#[derive(Deserialize, Serialize, Debug, Clone)]
618#[serde(rename_all = "camelCase")]
619#[cfg_attr(feature = "integration_testing", derive(Dummy))]
620pub enum ThreadEventReason {
621 Started,
622 Exited,
623 #[serde(untagged)]
624 String(String),
625}
626
627#[derive(Deserialize, Serialize, Debug, Default, Clone)]
628#[serde(rename_all = "camelCase")]
629#[cfg_attr(feature = "integration_testing", derive(Dummy))]
630pub struct ValueFormat {
631 /// Display the value in hex.
632 #[serde(skip_serializing_if = "Option::is_none")]
633 pub hex: Option<bool>,
634}
635
636#[derive(Deserialize, Serialize, Debug, Default, Clone)]
637#[serde(rename_all = "camelCase")]
638pub struct StackFrameFormat {
639 /// Displays parameters for the stack frame.
640 #[serde(skip_serializing_if = "Option::is_none")]
641 pub parameters: Option<bool>,
642 /// Displays the types of parameters for the stack frame.
643 #[serde(skip_serializing_if = "Option::is_none")]
644 pub parameter_types: Option<bool>,
645 /// Displays the names of parameters for the stack frame.
646 #[serde(skip_serializing_if = "Option::is_none")]
647 pub parameter_names: Option<bool>,
648 /// Displays the values of parameters for the stack frame.
649 #[serde(skip_serializing_if = "Option::is_none")]
650 pub parameter_values: Option<bool>,
651 /// Displays the line i64 of the stack frame.
652 #[serde(skip_serializing_if = "Option::is_none")]
653 pub line: Option<bool>,
654 /// Displays the module of the stack frame.
655 #[serde(skip_serializing_if = "Option::is_none")]
656 pub module: Option<bool>,
657 /// Includes all stack frames, including those the debug adapter might
658 /// otherwise hide.
659 #[serde(skip_serializing_if = "Option::is_none")]
660 pub include_all: Option<bool>,
661}
662
663#[derive(Deserialize, Serialize, Debug, Clone)]
664#[serde(rename_all = "camelCase")]
665#[cfg_attr(feature = "integration_testing", derive(Dummy))]
666pub enum EvaluateArgumentsContext {
667 Variables,
668 Watch,
669 Repl,
670 Hover,
671 Clipboard,
672 #[serde(untagged)]
673 String(String),
674}
675
676#[derive(Deserialize, Serialize, Debug, Clone)]
677#[serde(rename_all = "camelCase")]
678#[cfg_attr(feature = "integration_testing", derive(Dummy))]
679pub enum SteppingGranularity {
680 Statement,
681 Line,
682 Instruction,
683}
684
685#[derive(Deserialize, Serialize, Debug, Clone)]
686#[serde(rename_all = "camelCase")]
687#[cfg_attr(feature = "integration_testing", derive(Dummy))]
688pub enum DataBreakpointAccessType {
689 Read,
690 Write,
691 ReadWrite,
692}
693
694#[derive(Deserialize, Serialize, Debug, Default, Clone)]
695#[serde(rename_all = "camelCase")]
696#[cfg_attr(feature = "integration_testing", derive(Dummy))]
697pub struct DataBreakpoint {
698 /// An id representing the data. This id is returned from the
699 /// `dataBreakpointInfo` request.
700 pub data_id: String,
701 /// The access type of the data.
702 #[serde(skip_serializing_if = "Option::is_none")]
703 pub access_type: Option<DataBreakpointAccessType>,
704 /// An expression for conditional breakpoints.
705 #[serde(skip_serializing_if = "Option::is_none")]
706 pub condition: Option<String>,
707 /// An expression that controls how many hits of the breakpoint are ignored.
708 /// The debug adapter is expected to interpret the expression as needed.
709 #[serde(skip_serializing_if = "Option::is_none")]
710 pub hit_condition: Option<String>,
711}
712
713/// Properties of a breakpoint passed to the setInstructionBreakpoints request
714///
715/// Specfication: [InstructionBreakpoint](https://microsoft.github.io/debug-adapter-protocol/specification#Types_InstructionBreakpoint)
716#[derive(Deserialize, Serialize, Debug, Default, Clone)]
717#[serde(rename_all = "camelCase")]
718#[cfg_attr(feature = "integration_testing", derive(Dummy))]
719pub struct InstructionBreakpoint {
720 /// The instruction reference of the breakpoint.
721 /// This should be a memory or instruction pointer reference from an
722 /// `EvaluateResponse`, `Variable`, `StackFrame`, `GotoTarget`, or
723 /// `Breakpoint`.
724 pub instruction_reference: String,
725 /// The offset from the instruction reference.
726 /// This can be negative.
727 #[serde(skip_serializing_if = "Option::is_none")]
728 pub offset: Option<i64>,
729 /// An expression for conditional breakpoints.
730 /// It is only honored by a debug adapter if the corresponding capability
731 /// `supportsConditionalBreakpoints` is true.
732 #[serde(skip_serializing_if = "Option::is_none")]
733 pub condition: Option<String>,
734 /// An expression that controls how many hits of the breakpoint are ignored.
735 /// The debug adapter is expected to interpret the expression as needed.
736 /// The attribute is only honored by a debug adapter if the corresponding
737 /// capability `supportsHitConditionalBreakpoints` is true.
738 #[serde(skip_serializing_if = "Option::is_none")]
739 pub hit_condition: Option<String>,
740}
741
742#[derive(Deserialize, Serialize, Debug, Clone)]
743#[serde(rename_all = "camelCase")]
744#[cfg_attr(feature = "integration_testing", derive(Dummy))]
745pub enum VariablesArgumentsFilter {
746 Indexed,
747 Named,
748}
749
750/// Properties of a breakpoint location returned from the breakpointLocations request.
751/// Specfication: [BreakpointLocation](https://microsoft.github.io/debug-adapter-protocol/specification#Types_BreakpointLocation)
752#[derive(Deserialize, Serialize, Debug, Default, Clone)]
753#[serde(rename_all = "camelCase")]
754#[cfg_attr(feature = "integration_testing", derive(Dummy))]
755pub struct BreakpointLocation {
756 /// Start line of breakpoint location.
757 pub line: i64,
758 /// The start position of a breakpoint location. Position is measured in UTF-16
759 /// code units and the client capability `columnsStartAt1` determines whether
760 /// it is 0- or 1-based.
761 #[serde(skip_serializing_if = "Option::is_none")]
762 pub column: Option<i64>,
763 /// The end line of breakpoint location if the location covers a range.
764 #[serde(skip_serializing_if = "Option::is_none")]
765 pub end_line: Option<i64>,
766 /// The end position of a breakpoint location (if the location covers a range).
767 /// Position is measured in UTF-16 code units and the client capability
768 /// `columnsStartAt1` determines whether it is 0- or 1-based.
769 #[serde(skip_serializing_if = "Option::is_none")]
770 pub end_column: Option<i64>,
771}
772
773/// Some predefined types for the CompletionItem. Please note that not all clients have specific
774/// icons for all of them
775///
776/// Specification: [CompletionItemType](https://microsoft.github.io/debug-adapter-protocol/specification#Types_CompletionItemType)
777#[derive(Deserialize, Serialize, Debug, Clone)]
778#[serde(rename_all = "camelCase")]
779#[cfg_attr(feature = "integration_testing", derive(Dummy))]
780pub enum CompletionItemType {
781 Method,
782 Function,
783 Constructor,
784 Field,
785 Variable,
786 Class,
787 Interface,
788 Module,
789 Property,
790 Unit,
791 Value,
792 Enum,
793 Keyword,
794 Snippet,
795 Text,
796 Color,
797 File,
798 Reference,
799 CustomColor,
800}
801
802/// `CompletionItems` are the suggestions returned from the `completions` request.
803///
804/// Specification: [CompletionItem](https://microsoft.github.io/debug-adapter-protocol/specification#Types_CompletionItem)
805#[derive(Deserialize, Serialize, Debug, Default, Clone)]
806#[serde(rename_all = "camelCase")]
807#[cfg_attr(feature = "integration_testing", derive(Dummy))]
808pub struct CompletionItem {
809 /// The label of this completion item. By default this is also the text that is
810 /// inserted when selecting this completion.
811 pub label: String,
812 /// If text is returned and not an empty String, then it is inserted instead of
813 /// the label.
814 #[serde(skip_serializing_if = "Option::is_none")]
815 pub text: Option<String>,
816 /// A String that should be used when comparing this item with other items. If
817 /// not returned or an empty String, the `label` is used instead.
818 #[serde(skip_serializing_if = "Option::is_none")]
819 pub sort_text: Option<String>,
820 /// A human-readable String with additional information about this item, like
821 /// type or symbol information.
822 #[serde(skip_serializing_if = "Option::is_none")]
823 pub detail: Option<String>,
824 /// The item's type. Typically the client uses this information to render the
825 /// item in the UI with an icon.
826 #[serde(rename = "type")]
827 #[serde(skip_serializing_if = "Option::is_none")]
828 pub type_field: Option<CompletionItemType>,
829 /// Start position (within the `text` attribute of the `completions` request)
830 /// where the completion text is added. The position is measured in UTF-16 code
831 /// units and the client capability `columnsStartAt1` determines whether it is
832 /// 0- or 1-based. If the start position is omitted the text is added at the
833 /// location specified by the `column` attribute of the `completions` request.
834 #[serde(skip_serializing_if = "Option::is_none")]
835 pub start: Option<i64>,
836 /// Length determines how many characters are overwritten by the completion
837 /// text and it is measured in UTF-16 code units. If missing the value 0 is
838 /// assumed which results in the completion text being inserted.
839 #[serde(skip_serializing_if = "Option::is_none")]
840 pub length: Option<i64>,
841 /// Determines the start of the new selection after the text has been inserted
842 /// (or replaced). `selectionStart` is measured in UTF-16 code units and must
843 /// be in the range 0 and length of the completion text. If omitted the
844 /// selection starts at the end of the completion text.
845 #[serde(skip_serializing_if = "Option::is_none")]
846 pub selection_start: Option<i64>,
847 /// Determines the length of the new selection after the text has been inserted
848 /// (or replaced) and it is measured in UTF-16 code units. The selection can
849 /// not extend beyond the bounds of the completion text. If omitted the length
850 /// is assumed to be 0.
851 #[serde(skip_serializing_if = "Option::is_none")]
852 pub selection_length: Option<i64>,
853}
854
855/// Represents a single disassembled instruction.
856///
857/// Specification: [DisassembledInstruction](https://microsoft.github.io/debug-adapter-protocol/specification#Types_DisassembledInstruction)
858#[derive(Deserialize, Serialize, Debug, Default, Clone)]
859#[serde(rename_all = "camelCase")]
860#[cfg_attr(feature = "integration_testing", derive(Dummy))]
861pub struct DisassembledInstruction {
862 /// The address of the instruction. Treated as a hex value if prefixed with
863 /// `0x`, or as a decimal value otherwise.
864 pub address: String,
865 /// Raw bytes representing the instruction and its operands, in an
866 /// implementation-defined format.
867 #[serde(skip_serializing_if = "Option::is_none")]
868 pub instruction_bytes: Option<String>,
869 /// Text representing the instruction and its operands, in an
870 /// implementation-defined format.
871 pub instruction: String,
872 /// Name of the symbol that corresponds with the location of this instruction,
873 /// if any.
874 #[serde(skip_serializing_if = "Option::is_none")]
875 pub symbol: Option<String>,
876 /// Source location that corresponds to this instruction, if any.
877 /// Should always be set (if available) on the first instruction returned,
878 /// but can be omitted afterwards if this instruction maps to the same source
879 /// file as the previous instruction.
880 #[serde(skip_serializing_if = "Option::is_none")]
881 pub location: Option<Source>,
882 /// The line within the source location that corresponds to this instruction,
883 /// if any.
884 #[serde(skip_serializing_if = "Option::is_none")]
885 pub line: Option<i64>,
886 /// The column within the line that corresponds to this instruction, if any.
887 #[serde(skip_serializing_if = "Option::is_none")]
888 pub column: Option<i64>,
889 /// The end line of the range that corresponds to this instruction, if any.
890 #[serde(skip_serializing_if = "Option::is_none")]
891 pub end_line: Option<i64>,
892 /// The end column of the range that corresponds to this instruction, if any.
893 #[serde(skip_serializing_if = "Option::is_none")]
894 pub end_column: Option<i64>,
895}
896
897#[derive(Deserialize, Serialize, Debug, Clone)]
898#[serde(rename_all = "camelCase")]
899#[cfg_attr(feature = "integration_testing", derive(Dummy))]
900pub enum VariablePresentationHintKind {
901 /// Indicates that the object is a property.
902 Property,
903 /// Indicates that the object is a method.
904 Method,
905 /// Indicates that the object is a class.
906 Class,
907 /// Indicates that the object is data.
908 Data,
909 /// Indicates that the object is an event.
910 Event,
911 /// Indicates that the object is a base class.
912 BaseClass,
913 /// Indicates that the object is an inner class.
914 InnerClass,
915 /// Indicates that the object is an interface.
916 Interface,
917 /// Indicates that the object is the most derived class.
918 MostDerivedClass,
919 /// Indicates that the object is virtual, that means it is a
920 /// synthetic object introduced by the adapter for rendering purposes, e.g. an
921 /// index range for large arrays.
922 Virtual,
923 /// Deprecated: Indicates that a data breakpoint is
924 /// registered for the object. The `hasDataBreakpoint` attribute should
925 /// generally be used instead.
926 DataBreakpoint,
927 #[serde(untagged)]
928 String(String),
929}
930
931/// Set of attributes represented as an array of Strings. Before introducing
932/// additional values, try to use the listed values.
933#[derive(Deserialize, Serialize, Debug, Clone)]
934#[serde(rename_all = "camelCase")]
935#[cfg_attr(feature = "integration_testing", derive(Dummy))]
936pub enum VariablePresentationHintAttributes {
937 /// Indicates that the object is static.
938 Static,
939 /// Indicates that the object is a constant.
940 Constant,
941 /// Indicates that the object is read only.
942 ReadOnly,
943 /// Indicates that the object is a raw String.
944 RawString,
945 /// Indicates that the object can have an Object ID created for it.
946 HasObjectId,
947 /// Indicates that the object has an Object ID associated with it.
948 CanHaveObjectId,
949 /// Indicates that the evaluation had side effects.
950 HasSideEffects,
951 /// Indicates that the object has its value tracked by a data breakpoint.
952 HasDataBreakpoint,
953 #[serde(untagged)]
954 String(String),
955}
956
957#[derive(Deserialize, Serialize, Debug, Clone)]
958#[serde(rename_all = "camelCase")]
959#[cfg_attr(feature = "integration_testing", derive(Dummy))]
960pub enum VariablePresentationHintVisibility {
961 Public,
962 Private,
963 Protected,
964 Internal,
965 Final,
966 #[serde(untagged)]
967 String(String),
968}
969
970#[derive(Deserialize, Serialize, Debug, Default, Clone)]
971#[cfg_attr(feature = "integration_testing", derive(Dummy))]
972#[serde(rename_all = "camelCase")]
973pub struct VariablePresentationHint {
974 /// The kind of variable. Before introducing additional values, try to use the
975 /// listed values.
976 /// Values:
977 /// 'property': Indicates that the object is a property.
978 /// 'method': Indicates that the object is a method.
979 /// 'class': Indicates that the object is a class.
980 /// 'data': Indicates that the object is data.
981 /// 'event': Indicates that the object is an event.
982 /// 'baseClass': Indicates that the object is a base class.
983 /// 'innerClass': Indicates that the object is an inner class.
984 /// 'interface': Indicates that the object is an interface.
985 /// 'mostDerivedClass': Indicates that the object is the most derived class.
986 /// 'virtual': Indicates that the object is virtual, that means it is a
987 /// synthetic object introduced by the adapter for rendering purposes, e.g. an
988 /// index range for large arrays.
989 /// 'dataBreakpoint': Deprecated: Indicates that a data breakpoint is
990 /// registered for the object. The `hasDataBreakpoint` attribute should
991 /// generally be used instead.
992 /// etc.
993 #[serde(skip_serializing_if = "Option::is_none")]
994 pub kind: Option<VariablePresentationHintKind>,
995 /// Set of attributes represented as an array of Strings. Before introducing
996 /// additional values, try to use the listed values.
997 /// Values:
998 /// 'static': Indicates that the object is static.
999 /// 'constant': Indicates that the object is a constant.
1000 /// 'readOnly': Indicates that the object is read only.
1001 /// 'rawString': Indicates that the object is a raw String.
1002 /// 'hasObjectId': Indicates that the object can have an Object ID created for
1003 /// it.
1004 /// 'canHaveObjectId': Indicates that the object has an Object ID associated
1005 /// with it.
1006 /// 'hasSideEffects': Indicates that the evaluation had side effects.
1007 /// 'hasDataBreakpoint': Indicates that the object has its value tracked by a
1008 /// data breakpoint.
1009 /// etc.
1010 #[serde(skip_serializing_if = "Option::is_none")]
1011 pub attributes: Option<Vec<VariablePresentationHintAttributes>>,
1012 /// Visibility of variable. Before introducing additional values, try to use
1013 /// the listed values.
1014 /// Values: 'public', 'private', 'protected', 'internal', 'final', etc.
1015 #[serde(skip_serializing_if = "Option::is_none")]
1016 pub visibility: Option<VariablePresentationHintVisibility>,
1017 /// If true, clients can present the variable with a UI that supports a
1018 /// specific gesture to trigger its evaluation.
1019 /// This mechanism can be used for properties that require executing code when
1020 /// retrieving their value and where the code execution can be expensive and/or
1021 /// produce side-effects. A typical example are properties based on a getter
1022 /// function.
1023 /// Please note that in addition to the `lazy` flag, the variable's
1024 /// `variablesReference` is expected to refer to a variable that will provide
1025 /// the value through another `variable` request.
1026 #[serde(skip_serializing_if = "Option::is_none")]
1027 pub lazy: Option<bool>,
1028}
1029
1030/// Detailed information about an exception that has occurred.
1031///
1032/// Specification: [ExceptionDetails](https://microsoft.github.io/debug-adapter-protocol/specification#Types_ExceptionDetails)
1033#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1034#[serde(rename_all = "camelCase")]
1035#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1036pub struct ExceptionDetails {
1037 /// Message contained in the exception.
1038 #[serde(skip_serializing_if = "Option::is_none")]
1039 pub message: Option<String>,
1040 /// Short type name of the exception object.
1041 #[serde(skip_serializing_if = "Option::is_none")]
1042 pub type_name: Option<String>,
1043 /// Fully-qualified type name of the exception object.
1044 #[serde(skip_serializing_if = "Option::is_none")]
1045 pub full_type_name: Option<String>,
1046 /// An expression that can be evaluated in the current scope to obtain the
1047 /// exception object.
1048 #[serde(skip_serializing_if = "Option::is_none")]
1049 pub evaluate_name: Option<String>,
1050 /// Stack trace at the time the exception was thrown.
1051 #[serde(skip_serializing_if = "Option::is_none")]
1052 pub stack_trace: Option<String>,
1053 /// Details of the exception contained by this exception, if any.
1054 #[serde(skip_serializing_if = "Option::is_none")]
1055 pub inner_exception: Option<Vec<ExceptionDetails>>,
1056}
1057
1058/// A `GotoTarget` describes a code location that can be used as a target in the
1059/// goto request.
1060/// The possible goto targets can be determined via the gotoTargets request.
1061///
1062/// Specification: [GotoTarget](https://microsoft.github.io/debug-adapter-protocol/specification#Types_GotoTarget)
1063#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1064#[serde(rename_all = "camelCase")]
1065#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1066pub struct GotoTarget {
1067 /// Unique identifier for a goto target. This is used in the `goto` request.
1068 pub id: i64,
1069 /// The name of the goto target (shown in the UI).
1070 pub label: String,
1071 /// The line of the goto target.
1072 pub line: i64,
1073 /// The column of the goto target.
1074 #[serde(skip_serializing_if = "Option::is_none")]
1075 pub column: Option<i64>,
1076 /// The end line of the range covered by the goto target.
1077 #[serde(skip_serializing_if = "Option::is_none")]
1078 pub end_line: Option<i64>,
1079 /// The end column of the range covered by the goto target.
1080 #[serde(skip_serializing_if = "Option::is_none")]
1081 pub end_column: Option<i64>,
1082 /// A memory reference for the instruction pointer value represented by this
1083 /// target.
1084 #[serde(skip_serializing_if = "Option::is_none")]
1085 pub instruction_pointer_reference: Option<String>,
1086}
1087
1088/// A hint for how to present this scope in the UI. If this attribute is
1089/// missing, the scope is shown with a generic UI.
1090///
1091/// Specification: [Scope](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope)
1092#[derive(Deserialize, Serialize, Debug, Clone)]
1093#[serde(rename_all = "camelCase")]
1094#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1095pub enum ScopePresentationhint {
1096 /// Scope contains method arguments.
1097 Arguments,
1098 /// Scope contains local variables.
1099 Locals,
1100 /// Scope contains registers. Only a single `registers` scope
1101 /// should be returned from a `scopes` request.
1102 Registers,
1103 #[serde(untagged)]
1104 String(String),
1105}
1106
1107/// A Scope is a named container for variables. Optionally a scope can map to a source or a range
1108/// within a source.
1109///
1110/// Specification: [Scope](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope)
1111#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1112#[serde(rename_all = "camelCase")]
1113#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1114pub struct Scope {
1115 /// Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This
1116 /// String is shown in the UI as is and can be translated.
1117 pub name: String,
1118 /// A hint for how to present this scope in the UI. If this attribute is
1119 /// missing, the scope is shown with a generic UI.
1120 /// Values:
1121 /// 'arguments': Scope contains method arguments.
1122 /// 'locals': Scope contains local variables.
1123 /// 'registers': Scope contains registers. Only a single `registers` scope
1124 /// should be returned from a `scopes` request.
1125 /// etc.
1126 #[serde(skip_serializing_if = "Option::is_none")]
1127 pub presentation_hint: Option<ScopePresentationhint>,
1128 /// The variables of this scope can be retrieved by passing the value of
1129 /// `variablesReference` to the `variables` request as long as execution
1130 /// remains suspended. See [Lifetime of Object References](https://microsoft.github.io/debug-adapter-protocol/overview#lifetime-of-objects-references)
1131 /// in the Overview section of the specification for details.
1132 pub variables_reference: i64,
1133 /// The i64 of named variables in this scope.
1134 /// The client can use this information to present the variables in a paged UI
1135 /// and fetch them in chunks.
1136 #[serde(skip_serializing_if = "Option::is_none")]
1137 pub named_variables: Option<i64>,
1138 /// The i64 of indexed variables in this scope.
1139 /// The client can use this information to present the variables in a paged UI
1140 /// and fetch them in chunks.
1141 #[serde(skip_serializing_if = "Option::is_none")]
1142 pub indexed_variables: Option<i64>,
1143 /// If true, the i64 of variables in this scope is large or expensive to
1144 /// retrieve.
1145 pub expensive: bool,
1146 /// The source for this scope.
1147 #[serde(skip_serializing_if = "Option::is_none")]
1148 pub source: Option<Source>,
1149 /// The start line of the range covered by this scope.
1150 #[serde(skip_serializing_if = "Option::is_none")]
1151 pub line: Option<i64>,
1152 /// Start position of the range covered by the scope. It is measured in UTF-16
1153 /// code units and the client capability `columnsStartAt1` determines whether
1154 /// it is 0- or 1-based.
1155 #[serde(skip_serializing_if = "Option::is_none")]
1156 pub column: Option<i64>,
1157 /// The end line of the range covered by this scope.
1158 #[serde(skip_serializing_if = "Option::is_none")]
1159 pub end_line: Option<i64>,
1160 /// End position of the range covered by the scope. It is measured in UTF-16
1161 /// code units and the client capability `columnsStartAt1` determines whether
1162 /// it is 0- or 1-based.
1163 #[serde(skip_serializing_if = "Option::is_none")]
1164 pub end_column: Option<i64>,
1165}
1166
1167#[derive(Deserialize, Serialize, Debug, Clone)]
1168#[serde(untagged)]
1169#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1170pub enum StackFrameModuleid {
1171 Number(i64),
1172 String(String),
1173}
1174
1175#[derive(Deserialize, Serialize, Debug, Clone)]
1176#[serde(rename_all = "camelCase")]
1177#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1178pub enum StackFramePresentationhint {
1179 Normal,
1180 Label,
1181 Subtle,
1182}
1183
1184/// A Stackframe contains the source location.
1185///
1186/// Specification: [StackFrame](https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame)
1187#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1188#[serde(rename_all = "camelCase")]
1189#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1190pub struct StackFrame {
1191 /// An identifier for the stack frame. It must be unique across all threads.
1192 /// This id can be used to retrieve the scopes of the frame with the `scopes`
1193 /// request or to restart the execution of a stackframe.
1194 pub id: i64,
1195 /// The name of the stack frame, typically a method name.
1196 pub name: String,
1197 /// The source of the frame.
1198 #[serde(skip_serializing_if = "Option::is_none")]
1199 pub source: Option<Source>,
1200 /// The line within the source of the frame. If the source attribute is missing
1201 /// or doesn't exist, `line` is 0 and should be ignored by the client.
1202 pub line: i64,
1203 /// Start position of the range covered by the stack frame. It is measured in
1204 /// UTF-16 code units and the client capability `columnsStartAt1` determines
1205 /// whether it is 0- or 1-based. If attribute `source` is missing or doesn't
1206 /// exist, `column` is 0 and should be ignored by the client.
1207 pub column: i64,
1208 /// The end line of the range covered by the stack frame.
1209 #[serde(skip_serializing_if = "Option::is_none")]
1210 pub end_line: Option<i64>,
1211 /// End position of the range covered by the stack frame. It is measured in
1212 /// UTF-16 code units and the client capability `columnsStartAt1` determines
1213 /// whether it is 0- or 1-based.
1214 #[serde(skip_serializing_if = "Option::is_none")]
1215 pub end_column: Option<i64>,
1216 /// Indicates whether this frame can be restarted with the `restart` request.
1217 /// Clients should only use this if the debug adapter supports the `restart`
1218 /// request and the corresponding capability `supportsRestartRequest` is true.
1219 #[serde(skip_serializing_if = "Option::is_none")]
1220 pub can_restart: Option<bool>,
1221 /// A memory reference for the current instruction pointer in this frame.
1222 #[serde(skip_serializing_if = "Option::is_none")]
1223 pub instruction_pointer_reference: Option<String>,
1224 /// The module associated with this frame, if any.
1225 #[serde(skip_serializing_if = "Option::is_none")]
1226 pub module_id: Option<StackFrameModuleid>,
1227 /// A hint for how to present this frame in the UI.
1228 /// A value of `label` can be used to indicate that the frame is an artificial
1229 /// frame that is used as a visual label or separator. A value of `subtle` can
1230 /// be used to change the appearance of a frame in a 'subtle' way.
1231 /// Values: 'normal', 'label', 'subtle'
1232 #[serde(skip_serializing_if = "Option::is_none")]
1233 pub presentation_hint: Option<StackFramePresentationhint>,
1234}
1235
1236/// A thread.
1237///
1238/// Specification: [Thread](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Thread)
1239#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1240#[serde(rename_all = "camelCase")]
1241#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1242pub struct Thread {
1243 /// Unique identifier for the thread.
1244 pub id: i64,
1245 /// The name of the thread.
1246 pub name: String,
1247}
1248
1249/// A Variable is a name/value pair.
1250///
1251/// The `type` attribute is shown if space permits or when hovering over the variable’s name.
1252///
1253/// The `kind` attribute is used to render additional properties of the variable, e.g. different
1254/// icons can be used to indicate that a variable is public or private.
1255///
1256/// If the value is structured (has children), a handle is provided to retrieve the children with
1257/// the `variables` request.
1258///
1259/// If the number of named or indexed children is large, the numbers should be returned via the
1260/// `namedVariables` and `indexedVariables` attributes.
1261///
1262/// The client can use this information to present the children in a paged UI and fetch them in
1263/// chunks.
1264#[derive(Deserialize, Serialize, Debug, Default, Clone)]
1265#[serde(rename_all = "camelCase")]
1266#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1267pub struct Variable {
1268 /// The variable's name.
1269 pub name: String,
1270 /// The variable's value.
1271 /// This can be a multi-line text, e.g. for a function the body of a function.
1272 /// For structured variables (which do not have a simple value), it is
1273 /// recommended to provide a one-line representation of the structured object.
1274 /// This helps to identify the structured object in the collapsed state when
1275 /// its children are not yet visible.
1276 /// An empty String can be used if no value should be shown in the UI.
1277 pub value: String,
1278 /// The type of the variable's value. Typically shown in the UI when hovering
1279 /// over the value.
1280 /// This attribute should only be returned by a debug adapter if the
1281 /// corresponding capability `supportsVariableType` is true.
1282 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
1283 pub type_field: Option<String>,
1284 /// Properties of a variable that can be used to determine how to render the
1285 /// variable in the UI.
1286 #[serde(skip_serializing_if = "Option::is_none")]
1287 pub presentation_hint: Option<VariablePresentationHint>,
1288 /// The evaluatable name of this variable which can be passed to the `evaluate`
1289 /// request to fetch the variable's value.
1290 #[serde(skip_serializing_if = "Option::is_none")]
1291 pub evaluate_name: Option<String>,
1292 /// If `variablesReference` is > 0, the variable is structured and its children
1293 /// can be retrieved by passing `variablesReference` to the `variables` request
1294 /// as long as execution remains suspended. See [Lifetime of Object References](https://microsoft.github.io/debug-adapter-protocol/overview#lifetime-of-objects-references)
1295 /// in the Overview section of the specification for details.
1296 pub variables_reference: i64,
1297 /// The i64 of named child variables.
1298 /// The client can use this information to present the children in a paged UI
1299 /// and fetch them in chunks.
1300 #[serde(skip_serializing_if = "Option::is_none")]
1301 pub named_variables: Option<i64>,
1302 /// The i64 of indexed child variables.
1303 /// The client can use this information to present the children in a paged UI
1304 /// and fetch them in chunks.
1305 #[serde(skip_serializing_if = "Option::is_none")]
1306 pub indexed_variables: Option<i64>,
1307 /// The memory reference for the variable if the variable represents executable
1308 /// code, such as a function pointer.
1309 /// This attribute is only required if the corresponding capability
1310 /// `supportsMemoryReferences` is true.
1311 #[serde(skip_serializing_if = "Option::is_none")]
1312 pub memory_reference: Option<String>,
1313}
1314
1315#[derive(Deserialize, Serialize, Debug, Clone)]
1316#[serde(rename_all = "camelCase")]
1317#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1318pub enum RunInTerminalRequestArgumentsKind {
1319 Integrated,
1320 External,
1321}
1322
1323#[derive(Deserialize, Serialize, Debug, Clone)]
1324#[serde(rename_all = "camelCase")]
1325#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1326pub enum StartDebuggingRequestKind {
1327 Launch,
1328 Attach,
1329}
1330
1331/// A structured message object. Used to return errors from requests.
1332///
1333/// Specification: [Message](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Message)
1334#[derive(Serialize, Debug, Default, Clone)]
1335#[serde(rename_all = "camelCase")]
1336#[cfg_attr(feature = "integration_testing", derive(Dummy))]
1337#[cfg_attr(feature = "client", derive(Deserialize))]
1338pub struct Message {
1339 /// Unique (within a debug adapter implementation) identifier for the message.
1340 /// The purpose of these error IDs is to help extension authors that have the
1341 /// requirement that every user visible error message needs a corresponding
1342 /// error i64, so that users or customer support can find information about
1343 /// the specific error more easily.
1344 pub id: i64,
1345 /// A format String for the message. Embedded variables have the form `{name}`.
1346 /// If variable name starts with an underscore character, the variable does not
1347 /// contain user data (PII) and can be safely used for telemetry purposes.
1348 pub format: String,
1349 /// An object used as a dictionary for looking up the variables in the format string.
1350 pub variables: HashMap<String, String>,
1351 /// An object used as a dictionary for looking up the variables in the format
1352 /// String.
1353 /// If true send to telemetry.
1354 pub send_telemetry: Option<bool>,
1355 /// If true show user.
1356 pub show_user: Option<bool>,
1357 /// A url where additional information about this message can be found.
1358 pub url: Option<String>,
1359 /// A label that is presented to the user as the UI for opening the url.
1360 pub url_label: Option<String>,
1361}
1362
1363#[cfg(test)]
1364mod tests {
1365 use super::*;
1366
1367 #[allow(unused)]
1368 #[test]
1369 fn test_checksum_algorithm_serde() {
1370 let sha = ChecksumAlgorithm::SHA256;
1371 let sha_ser = serde_json::to_value(sha).unwrap();
1372 assert_eq!("SHA256", sha_ser);
1373 let sha_deser: ChecksumAlgorithm = serde_json::from_value(sha_ser).unwrap();
1374 assert!(matches!(ChecksumAlgorithm::SHA256, sha_deser));
1375
1376 let ts = ChecksumAlgorithm::Timestamp;
1377 let ts_ser = serde_json::to_value(&ts).unwrap();
1378 assert_eq!("timestamp", ts_ser);
1379 #[allow(unused)]
1380 let ts_deser: ChecksumAlgorithm = serde_json::from_value(ts_ser).unwrap();
1381 assert!(matches!(ChecksumAlgorithm::Timestamp, ts_deser));
1382 }
1383
1384 #[allow(unused)]
1385 #[test]
1386 fn test_invalidated_areas_serde() {
1387 let str = "string".to_string();
1388 let untagged = InvalidatedAreas::String(str.clone());
1389 let untagged_ser = serde_json::to_value(untagged).unwrap();
1390 assert_eq!(str, untagged_ser);
1391 let untagged_deser: InvalidatedAreas = serde_json::from_value(untagged_ser).unwrap();
1392 assert!(matches!(InvalidatedAreas::String(str), untagged_deser));
1393 }
1394}