debug_adapter_protocol/
requests.rs

1use crate::{
2    types::{
3        DataBreakpoint, ExceptionFilterOptions, ExceptionOptions, FunctionBreakpoint,
4        InstructionBreakpoint, Source, SourceBreakpoint, StackFrameFormat, SteppingGranularity,
5        ValueFormat,
6    },
7    utils::{eq_default, true_},
8    ProtocolMessageContent,
9};
10use serde::{Deserialize, Serialize};
11use serde_json::{Map, Value};
12use std::collections::HashMap;
13use typed_builder::TypedBuilder;
14
15/// A client or debug adapter initiated request.
16#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
17#[serde(rename_all = "camelCase", tag = "command", content = "arguments")]
18pub enum Request {
19    /// The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running.
20    ///
21    /// Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification.
22    Attach(AttachRequestArguments),
23
24    /// The 'breakpointLocations' request returns all possible locations for source breakpoints in a given range.
25    ///
26    /// Clients should only call this request if the capability 'supportsBreakpointLocationsRequest' is true.
27    BreakpointLocations(BreakpointLocationsRequestArguments),
28
29    /// The 'cancel' request is used by the frontend in two situations:
30    ///
31    /// - to indicate that it is no longer interested in the result produced by a specific request issued earlier
32    ///
33    /// - to cancel a progress sequence. Clients should only call this request if the capability 'supportsCancelRequest' is true.
34    ///
35    /// This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honouring this request but there are no guarantees.
36    ///
37    /// The 'cancel' request may return an error if it could not cancel an operation but a frontend should refrain from presenting this error to end users.
38    ///
39    /// A frontend client should only call this request if the capability 'supportsCancelRequest' is true.
40    ///
41    /// The request that got canceled still needs to send a response back. This can either be a normal result ('success' attribute true)
42    ///
43    /// or an error response ('success' attribute false and the 'message' set to 'cancelled').
44    ///
45    /// Returning partial results from a cancelled request is possible but please note that a frontend client has no generic way for detecting that a response is partial or not.
46    ///
47    ///  The progress that got cancelled still needs to send a 'progressEnd' event back.
48    ///
49    ///  A client should not assume that progress just got cancelled after sending the 'cancel' request.
50    Cancel(CancelRequestArguments),
51
52    /// Returns a list of possible completions for a given caret position and text.
53    ///
54    /// Clients should only call this request if the capability 'supportsCompletionsRequest' is true.
55    Completions(CompletionsRequestArguments),
56
57    /// This optional request indicates that the client has finished initialization of the debug adapter.
58    ///
59    /// So it is the last request in the sequence of configuration requests (which was started by the 'initialized' event).
60    ///
61    /// Clients should only call this request if the capability 'supportsConfigurationDoneRequest' is true.
62    ConfigurationDone,
63
64    /// The request starts the debuggee to run again.
65    Continue(ContinueRequestArguments),
66
67    /// Obtains information on a possible data breakpoint that could be set on an expression or variable.
68    ///
69    /// Clients should only call this request if the capability 'supportsDataBreakpoints' is true.
70    DataBreakpointInfo(DataBreakpointInfoRequestArguments),
71
72    /// Disassembles code stored at the provided location.
73    ///
74    /// Clients should only call this request if the capability 'supportsDisassembleRequest' is true.
75    Disassemble(DisassembleRequestArguments),
76
77    /// The 'disconnect' request is sent from the client to the debug adapter in order to stop debugging.
78    ///
79    /// It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter.
80    ///
81    /// If the debuggee has been started with the 'launch' request, the 'disconnect' request terminates the debuggee.
82    ///
83    /// If the 'attach' request was used to connect to the debuggee, 'disconnect' does not terminate the debuggee.
84    ///
85    /// This behavior can be controlled with the 'terminateDebuggee' argument (if supported by the debug adapter).
86    Disconnect(DisconnectRequestArguments),
87
88    /// Evaluates the given expression in the context of the top most stack frame.
89    ///
90    /// The expression has access to any variables and arguments that are in scope.
91    Evaluate(EvaluateRequestArguments),
92
93    /// Retrieves the details of the exception that caused this event to be raised.
94    ///
95    /// Clients should only call this request if the capability 'supportsExceptionInfoRequest' is true.
96    ExceptionInfo(ExceptionInfoRequestArguments),
97
98    /// The request sets the location where the debuggee will continue to run.
99    ///
100    /// This makes it possible to skip the execution of code or to executed code again.
101    ///
102    /// The code between the current location and the goto target is not executed but skipped.
103    ///
104    /// The debug adapter first sends the response and then a 'stopped' event with reason 'goto'.
105    ///
106    /// Clients should only call this request if the capability 'supportsGotoTargetsRequest' is true (because only then goto targets exist that can be passed as arguments).
107    Goto(GotoRequestArguments),
108
109    /// This request retrieves the possible goto targets for the specified source location.
110    ///
111    /// These targets can be used in the 'goto' request.
112    ///
113    /// Clients should only call this request if the capability 'supportsGotoTargetsRequest' is true.
114    GotoTargets(GotoTargetsRequestArguments),
115
116    /// The 'initialize' request is sent as the first request from the client to the debug adapter
117    ///
118    /// in order to configure it with client capabilities and to retrieve capabilities from the debug adapter.
119    ///
120    /// Until the debug adapter has responded to with an 'initialize' response, the client must not send any additional requests or events to the debug adapter.
121    ///
122    /// In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an 'initialize' response.
123    ///
124    /// The 'initialize' request may only be sent once.
125    Initialize(InitializeRequestArguments),
126
127    /// This launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if 'noDebug' is true).
128    ///
129    /// Since launching is debugger/runtime specific, the arguments for this request are not part of this specification.
130    Launch(LaunchRequestArguments),
131
132    /// Retrieves the set of all sources currently loaded by the debugged process.
133    ///
134    /// Clients should only call this request if the capability 'supportsLoadedSourcesRequest' is true.
135    LoadedSources,
136
137    /// Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging.
138    ///
139    /// Clients should only call this request if the capability 'supportsModulesRequest' is true.
140    Modules(ModulesRequestArguments),
141
142    /// The request starts the debuggee to run again for one step.
143    ///
144    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed.
145    Next(NextRequestArguments),
146
147    /// The request suspends the debuggee.
148    ///
149    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'pause') after the thread has been paused successfully.
150    Pause(PauseRequestArguments),
151
152    /// Reads bytes from memory at the provided location.
153    ///
154    /// Clients should only call this request if the capability 'supportsReadMemoryRequest' is true.
155    ReadMemory(ReadMemoryRequestArguments),
156
157    /// The request restarts execution of the specified stackframe.
158    ///
159    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'restart') after the restart has completed.
160    ///
161    /// Clients should only call this request if the capability 'supportsRestartFrame' is true.
162    RestartFrame(RestartFrameRequestArguments),
163
164    // /// Restarts a debug session. Clients should only call this request if the capability 'supportsRestartRequest' is true.
165    // ///
166    // /// If the capability is missing or has the value false, a typical client will emulate 'restart' by terminating the debug adapter first and then launching it anew.
167    // Restart(RestartRequestArguments), TODO
168    /// The request starts the debuggee to run backward.
169    ///
170    /// Clients should only call this request if the capability 'supportsStepBack' is true.
171    ReverseContinue(ReverseContinueRequestArguments),
172
173    /// This optional request is sent from the debug adapter to the client to run a command in a terminal.
174    ///
175    /// This is typically used to launch the debuggee in a terminal provided by the client.
176    ///
177    /// This request should only be called if the client has passed the value true for the 'supportsRunInTerminalRequest' capability of the 'initialize' request.
178    RunInTerminal(RunInTerminalRequestArguments),
179
180    /// The request returns the variable scopes for a given stackframe ID.
181    Scopes(ScopesRequestArguments),
182
183    /// Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
184    ///
185    /// To clear all breakpoint for a source, specify an empty array.
186    ///
187    /// When a breakpoint is hit, a 'stopped' event (with reason 'breakpoint') is generated.
188    SetBreakpoints(SetBreakpointsRequestArguments),
189
190    /// Replaces all existing data breakpoints with new data breakpoints.
191    ///
192    /// To clear all data breakpoints, specify an empty array.
193    ///
194    /// When a data breakpoint is hit, a 'stopped' event (with reason 'data breakpoint') is generated.
195    ///
196    /// Clients should only call this request if the capability 'supportsDataBreakpoints' is true.
197    SetDataBreakpoints(SetDataBreakpointsRequestArguments),
198
199    /// The request configures the debuggers response to thrown exceptions.
200    ///
201    /// If an exception is configured to break, a 'stopped' event is fired (with reason 'exception').
202    ///
203    /// Clients should only call this request if the capability 'exceptionBreakpointFilters' returns one or more filters.
204    SetExceptionBreakpoints(SetExceptionBreakpointsRequestArguments),
205
206    /// Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value.
207    ///
208    /// The expressions have access to any variables and arguments that are in scope of the specified frame.
209    ///
210    /// Clients should only call this request if the capability 'supportsSetExpression' is true.
211    ///
212    /// If a debug adapter implements both setExpression and setVariable, a client will only use setExpression if the variable has an evaluateName property.
213    SetExpression(SetExpressionRequestArguments),
214
215    /// Replaces all existing function breakpoints with new function breakpoints.
216    ///
217    /// To clear all function breakpoints, specify an empty array.
218    ///
219    /// When a function breakpoint is hit, a 'stopped' event (with reason 'function breakpoint') is generated.
220    ///
221    /// Clients should only call this request if the capability 'supportsFunctionBreakpoints' is true.
222    SetFunctionBreakpoints(SetFunctionBreakpointsRequestArguments),
223
224    /// Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a diassembly window.
225    ///
226    /// To clear all instruction breakpoints, specify an empty array.
227    ///
228    /// When an instruction breakpoint is hit, a 'stopped' event (with reason 'instruction breakpoint') is generated.
229    ///
230    /// Clients should only call this request if the capability 'supportsInstructionBreakpoints' is true.
231    SetInstructionBreakpoints(SetInstructionBreakpointsRequestArguments),
232
233    /// Set the variable with the given name in the variable container to a new value. Clients should only call this request if the capability 'supportsSetVariable' is true.
234    ///
235    /// If a debug adapter implements both setVariable and setExpression, a client will only use setExpression if the variable has an evaluateName property.
236    SetVariable(SetVariableRequestArguments),
237
238    /// The request retrieves the source code for a given source reference.
239    Source(SourceRequestArguments),
240
241    /// The request returns a stacktrace from the current execution state of a given thread.
242    ///
243    /// A client can request all stack frames by omitting the startFrame and levels arguments. For performance conscious clients and if the debug adapter's 'supportsDelayedStackTraceLoading' capability is true, stack frames can be retrieved in a piecemeal way with the startFrame and levels arguments. The response of the stackTrace request may contain a totalFrames property that hints at the total number of frames in the stack. If a client needs this total number upfront, it can issue a request for a single (first) frame and depending on the value of totalFrames decide how to proceed. In any case a client should be prepared to receive less frames than requested, which is an indication that the end of the stack has been reached.
244    StackTrace(StackTraceRequestArguments),
245
246    /// The request starts the debuggee to run one step backwards.
247    ///
248    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed.
249    ///
250    /// Clients should only call this request if the capability 'supportsStepBack' is true.
251    StepBack(StepBackRequestArguments),
252
253    /// The request starts the debuggee to step into a function/method if possible.
254    ///
255    /// If it cannot step into a target, 'stepIn' behaves like 'next'.
256    ///
257    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed.
258    ///
259    /// If there are multiple function/method calls (or other targets) on the source line,
260    ///
261    /// the optional argument 'targetId' can be used to control into which target the 'stepIn' should occur.
262    ///
263    /// The list of possible targets for a given source line can be retrieved via the 'stepInTargets' request.
264    StepIn(StepInRequestArguments),
265
266    /// This request retrieves the possible stepIn targets for the specified stack frame.
267    ///
268    /// These targets can be used in the 'stepIn' request.
269    ///
270    /// The StepInTargets may only be called if the 'supportsStepInTargetsRequest' capability exists and is true.
271    ///
272    /// Clients should only call this request if the capability 'supportsStepInTargetsRequest' is true.
273    StepInTargets(StepInTargetsRequestArguments),
274
275    /// The request starts the debuggee to run again for one step.
276    ///
277    /// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed.
278    StepOut(StepOutRequestArguments),
279
280    /// The 'terminate' request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself.
281    ///
282    /// Clients should only call this request if the capability 'supportsTerminateRequest' is true.
283    Terminate(TerminateRequestArguments),
284
285    /// The request terminates the threads with the given ids.
286    ///
287    /// Clients should only call this request if the capability 'supportsTerminateThreadsRequest' is true.
288    TerminateThreads(TerminateThreadsRequestArguments),
289
290    /// The request retrieves a list of all threads.
291    Threads,
292
293    /// Retrieves all child variables for the given variable reference.
294    ///
295    /// An optional filter can be used to limit the fetched children to either named or indexed children.
296    Variables(VariablesRequestArguments),
297}
298impl From<Request> for ProtocolMessageContent {
299    fn from(request: Request) -> Self {
300        Self::Request(request)
301    }
302}
303
304#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
305pub struct AttachRequestArguments {
306    /// Optional data from the previous, restarted session.
307    ///
308    /// The data is sent as the 'restart' attribute of the 'terminated' event.
309    ///
310    /// The client should leave the data intact.
311    #[serde(rename = "__restart", skip_serializing_if = "Option::is_none")]
312    #[builder(default)]
313    pub restart: Option<Value>,
314
315    #[serde(skip)]
316    #[builder(default, setter(skip))]
317    private: (),
318}
319impl From<AttachRequestArguments> for Request {
320    fn from(args: AttachRequestArguments) -> Self {
321        Self::Attach(args)
322    }
323}
324impl From<AttachRequestArguments> for ProtocolMessageContent {
325    fn from(args: AttachRequestArguments) -> Self {
326        Self::from(Request::from(args))
327    }
328}
329
330#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
331pub struct BreakpointLocationsRequestArguments {
332    /// The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified.
333    #[serde(rename = "source")]
334    pub source: Source,
335
336    /// Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line.
337    #[serde(rename = "line")]
338    pub line: i32,
339
340    /// Optional start column of range to search possible breakpoint locations in. If no start column is given, the first column in the start line is assumed.
341    #[serde(rename = "column", skip_serializing_if = "Option::is_none")]
342    #[builder(default)]
343    pub column: Option<i32>,
344
345    /// Optional end line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line.
346    #[serde(rename = "endLine", skip_serializing_if = "Option::is_none")]
347    #[builder(default)]
348    pub end_line: Option<i32>,
349
350    /// Optional end column of range to search possible breakpoint locations in. If no end column is given, then it is assumed to be in the last column of the end line.
351    #[serde(rename = "endColumn", skip_serializing_if = "Option::is_none")]
352    #[builder(default)]
353    pub end_column: Option<i32>,
354
355    #[serde(skip)]
356    #[builder(default, setter(skip))]
357    private: (),
358}
359impl From<BreakpointLocationsRequestArguments> for Request {
360    fn from(args: BreakpointLocationsRequestArguments) -> Self {
361        Self::BreakpointLocations(args)
362    }
363}
364impl From<BreakpointLocationsRequestArguments> for ProtocolMessageContent {
365    fn from(args: BreakpointLocationsRequestArguments) -> Self {
366        Self::from(Request::from(args))
367    }
368}
369
370#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
371pub struct CancelRequestArguments {
372    /// The ID (attribute 'seq') of the request to cancel. If missing no request is cancelled.
373    ///
374    /// Both a 'requestId' and a 'progressId' can be specified in one request.
375    #[serde(rename = "requestId", skip_serializing_if = "Option::is_none")]
376    #[builder(default)]
377    pub request_id: Option<i32>,
378
379    /// The ID (attribute 'progressId') of the progress to cancel. If missing no progress is cancelled.
380    ///
381    /// Both a 'requestId' and a 'progressId' can be specified in one request.
382    #[serde(rename = "progressId", skip_serializing_if = "Option::is_none")]
383    #[builder(default)]
384    pub progress_id: Option<String>,
385
386    #[serde(skip)]
387    #[builder(default, setter(skip))]
388    private: (),
389}
390impl From<CancelRequestArguments> for Request {
391    fn from(args: CancelRequestArguments) -> Self {
392        Self::Cancel(args)
393    }
394}
395impl From<CancelRequestArguments> for ProtocolMessageContent {
396    fn from(args: CancelRequestArguments) -> Self {
397        Self::from(Request::from(args))
398    }
399}
400
401#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
402pub struct CompletionsRequestArguments {
403    /// Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope.
404    #[serde(rename = "frameId", skip_serializing_if = "Option::is_none")]
405    #[builder(default)]
406    pub frame_id: Option<i32>,
407
408    /// One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion.
409    #[serde(rename = "text")]
410    pub text: String,
411
412    /// The character position for which to determine the completion proposals.
413    #[serde(rename = "column")]
414    pub column: i32,
415
416    /// An optional line for which to determine the completion proposals. If missing the first line of the text is assumed.
417    #[serde(rename = "line", skip_serializing_if = "Option::is_none")]
418    #[builder(default)]
419    pub line: Option<i32>,
420
421    #[serde(skip)]
422    #[builder(default, setter(skip))]
423    private: (),
424}
425impl From<CompletionsRequestArguments> for Request {
426    fn from(args: CompletionsRequestArguments) -> Self {
427        Self::Completions(args)
428    }
429}
430impl From<CompletionsRequestArguments> for ProtocolMessageContent {
431    fn from(args: CompletionsRequestArguments) -> Self {
432        Self::from(Request::from(args))
433    }
434}
435
436#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
437pub struct ContinueRequestArguments {
438    /// Continue execution for the specified thread (if possible).
439    ///
440    /// If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true.
441    #[serde(rename = "threadId")]
442    pub thread_id: i32,
443
444    #[serde(skip)]
445    #[builder(default, setter(skip))]
446    private: (),
447}
448impl From<ContinueRequestArguments> for Request {
449    fn from(args: ContinueRequestArguments) -> Self {
450        Self::Continue(args)
451    }
452}
453impl From<ContinueRequestArguments> for ProtocolMessageContent {
454    fn from(args: ContinueRequestArguments) -> Self {
455        Self::from(Request::from(args))
456    }
457}
458
459#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
460pub struct DataBreakpointInfoRequestArguments {
461    /// Reference to the Variable container if the data breakpoint is requested for a child of the container.
462    #[serde(rename = "variablesReference", skip_serializing_if = "Option::is_none")]
463    #[builder(default)]
464    pub variables_reference: Option<i32>,
465
466    /// The name of the Variable's child to obtain data breakpoint information for.
467    ///
468    /// If variablesReference isn’t provided, this can be an expression.
469    #[serde(rename = "name")]
470    pub name: String,
471
472    #[serde(skip)]
473    #[builder(default, setter(skip))]
474    private: (),
475}
476impl From<DataBreakpointInfoRequestArguments> for Request {
477    fn from(args: DataBreakpointInfoRequestArguments) -> Self {
478        Self::DataBreakpointInfo(args)
479    }
480}
481impl From<DataBreakpointInfoRequestArguments> for ProtocolMessageContent {
482    fn from(args: DataBreakpointInfoRequestArguments) -> Self {
483        Self::from(Request::from(args))
484    }
485}
486
487#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
488pub struct DisassembleRequestArguments {
489    /// Memory reference to the base location containing the instructions to disassemble.
490    #[serde(rename = "memoryReference")]
491    pub memory_reference: String,
492
493    /// Optional offset (in bytes) to be applied to the reference location before disassembling. Can be negative.
494    #[serde(rename = "offset", default, skip_serializing_if = "eq_default")]
495    #[builder(default)]
496    pub offset: i32,
497
498    /// Optional offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative.
499    #[serde(
500        rename = "instructionOffset",
501        default,
502        skip_serializing_if = "eq_default"
503    )]
504    #[builder(default)]
505    pub instruction_offset: i32,
506
507    /// Number of instructions to disassemble starting at the specified location and offset.
508    ///
509    /// An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value.
510    #[serde(rename = "instructionCount")]
511    pub instruction_count: i32,
512
513    /// If true, the adapter should attempt to resolve memory addresses and other values to symbolic names.
514    #[serde(rename = "resolveSymbols", default, skip_serializing_if = "eq_default")]
515    #[builder(default)]
516    pub resolve_symbols: bool,
517
518    #[serde(skip)]
519    #[builder(default, setter(skip))]
520    private: (),
521}
522impl From<DisassembleRequestArguments> for Request {
523    fn from(args: DisassembleRequestArguments) -> Self {
524        Self::Disassemble(args)
525    }
526}
527impl From<DisassembleRequestArguments> for ProtocolMessageContent {
528    fn from(args: DisassembleRequestArguments) -> Self {
529        Self::from(Request::from(args))
530    }
531}
532
533#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
534pub struct DisconnectRequestArguments {
535    /// A value of true indicates that this 'disconnect' request is part of a restart sequence.
536    #[serde(rename = "restart", default, skip_serializing_if = "eq_default")]
537    #[builder(default)]
538    pub restart: bool,
539
540    /// Indicates whether the debuggee should be terminated when the debugger is disconnected.
541    ///
542    /// If unspecified, the debug adapter is free to do whatever it thinks is best.
543    ///
544    /// The attribute is only honored by a debug adapter if the capability 'supportTerminateDebuggee' is true.
545    #[serde(rename = "terminateDebuggee", skip_serializing_if = "Option::is_none")]
546    #[builder(default)]
547    pub terminate_debuggee: Option<bool>,
548
549    /// Indicates whether the debuggee should stay suspended when the debugger is disconnected.
550    ///
551    /// If unspecified, the debuggee should resume execution.
552    ///
553    /// The attribute is only honored by a debug adapter if the capability 'supportSuspendDebuggee' is true.
554    #[serde(
555        rename = "suspendDebuggee",
556        default,
557        skip_serializing_if = "eq_default"
558    )]
559    #[builder(default)]
560    pub suspend_debuggee: bool,
561
562    #[serde(skip)]
563    #[builder(default, setter(skip))]
564    private: (),
565}
566impl From<DisconnectRequestArguments> for Request {
567    fn from(args: DisconnectRequestArguments) -> Self {
568        Self::Disconnect(args)
569    }
570}
571impl From<DisconnectRequestArguments> for ProtocolMessageContent {
572    fn from(args: DisconnectRequestArguments) -> Self {
573        Self::from(Request::from(args))
574    }
575}
576
577#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
578pub struct EvaluateRequestArguments {
579    /// The expression to evaluate.
580    #[serde(rename = "expression")]
581    pub expression: String,
582
583    /// Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope.
584    #[serde(rename = "frameId", skip_serializing_if = "Option::is_none")]
585    #[builder(default)]
586    pub frame_id: Option<i32>,
587
588    /// The context in which the evaluate request is run.
589    #[serde(rename = "context", skip_serializing_if = "Option::is_none")]
590    #[builder(default)]
591    pub context: Option<EvaluateRequestContext>,
592
593    /// Specifies details on how to format the Evaluate result.
594    ///
595    /// The attribute is only honored by a debug adapter if the capability 'supportsValueFormattingOptions' is true.
596    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
597    #[builder(default)]
598    pub format: Option<ValueFormat>,
599
600    #[serde(skip)]
601    #[builder(default, setter(skip))]
602    private: (),
603}
604impl From<EvaluateRequestArguments> for Request {
605    fn from(args: EvaluateRequestArguments) -> Self {
606        Self::Evaluate(args)
607    }
608}
609impl From<EvaluateRequestArguments> for ProtocolMessageContent {
610    fn from(args: EvaluateRequestArguments) -> Self {
611        Self::from(Request::from(args))
612    }
613}
614
615#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
616#[serde(rename_all = "lowercase")]
617pub enum EvaluateRequestContext {
618    /// evaluate is run in a watch.
619    Watch,
620
621    /// evaluate is run from REPL console.
622    REPL,
623
624    /// evaluate is run from a data hover.
625    Hover,
626
627    /// evaluate is run to generate the value that will be stored in the clipboard.
628    ///
629    /// The attribute is only honored by a debug adapter if the capability 'supportsClipboardContext' is true.
630    Clipboard,
631}
632
633#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
634pub struct ExceptionInfoRequestArguments {
635    /// Thread for which exception information should be retrieved.
636    #[serde(rename = "threadId")]
637    pub thread_id: i32,
638
639    #[serde(skip)]
640    #[builder(default, setter(skip))]
641    private: (),
642}
643impl From<ExceptionInfoRequestArguments> for Request {
644    fn from(args: ExceptionInfoRequestArguments) -> Self {
645        Self::ExceptionInfo(args)
646    }
647}
648impl From<ExceptionInfoRequestArguments> for ProtocolMessageContent {
649    fn from(args: ExceptionInfoRequestArguments) -> Self {
650        Self::from(Request::from(args))
651    }
652}
653
654#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
655pub struct GotoRequestArguments {
656    /// Set the goto target for this thread.
657    #[serde(rename = "threadId")]
658    pub thread_id: i32,
659
660    /// The location where the debuggee will continue to run.
661    #[serde(rename = "targetId")]
662    pub target_id: i32,
663
664    #[serde(skip)]
665    #[builder(default, setter(skip))]
666    private: (),
667}
668impl From<GotoRequestArguments> for Request {
669    fn from(args: GotoRequestArguments) -> Self {
670        Self::Goto(args)
671    }
672}
673impl From<GotoRequestArguments> for ProtocolMessageContent {
674    fn from(args: GotoRequestArguments) -> Self {
675        Self::from(Request::from(args))
676    }
677}
678
679#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
680pub struct GotoTargetsRequestArguments {
681    /// The source location for which the goto targets are determined.
682    #[serde(rename = "source")]
683    pub source: Source,
684
685    /// The line location for which the goto targets are determined.
686    #[serde(rename = "line")]
687    pub line: i32,
688
689    /// An optional column location for which the goto targets are determined.
690    #[serde(rename = "column", skip_serializing_if = "Option::is_none")]
691    #[builder(default)]
692    pub column: Option<i32>,
693
694    #[serde(skip)]
695    #[builder(default, setter(skip))]
696    private: (),
697}
698impl From<GotoTargetsRequestArguments> for Request {
699    fn from(args: GotoTargetsRequestArguments) -> Self {
700        Self::GotoTargets(args)
701    }
702}
703impl From<GotoTargetsRequestArguments> for ProtocolMessageContent {
704    fn from(args: GotoTargetsRequestArguments) -> Self {
705        Self::from(Request::from(args))
706    }
707}
708
709#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
710pub struct InitializeRequestArguments {
711    /// The ID of the (frontend) client using this adapter.
712    #[serde(rename = "clientID", skip_serializing_if = "Option::is_none")]
713    #[builder(default)]
714    pub client_id: Option<String>,
715
716    /// The human readable name of the (frontend) client using this adapter.
717    #[serde(rename = "clientName", skip_serializing_if = "Option::is_none")]
718    #[builder(default)]
719    pub client_name: Option<String>,
720
721    /// The ID of the debug adapter.
722    #[serde(rename = "adapterID")]
723    pub adapter_id: String,
724
725    /// The ISO-639 locale of the (frontend) client using this adapter, e.g. en-US or de-CH.
726    #[serde(rename = "locale", skip_serializing_if = "Option::is_none")]
727    #[builder(default)]
728    pub locale: Option<String>,
729
730    /// If true all line numbers are 1-based (default).
731    #[serde(rename = "linesStartAt1", default = "true_")]
732    #[builder(default = true)]
733    pub lines_start_at_1: bool,
734
735    /// If true all column numbers are 1-based (default).
736    #[serde(rename = "columnsStartAt1", default = "true_")]
737    #[builder(default = true)]
738    pub columns_start_at_1: bool,
739
740    /// Determines in what format paths are specified. The default is 'path', which is the native format.
741    #[serde(rename = "pathFormat", default, skip_serializing_if = "eq_default")]
742    #[builder(default)]
743    pub path_format: PathFormat,
744
745    /// Client supports the optional type attribute for variables.
746    #[serde(
747        rename = "supportsVariableType",
748        default,
749        skip_serializing_if = "eq_default"
750    )]
751    #[builder(default)]
752    pub supports_variable_type: bool,
753
754    /// Client supports the paging of variables.
755    #[serde(
756        rename = "supportsVariablePaging",
757        default,
758        skip_serializing_if = "eq_default"
759    )]
760    #[builder(default)]
761    pub supports_variable_paging: bool,
762
763    /// Client supports the runInTerminal request.
764    #[serde(
765        rename = "supportsRunInTerminalRequest",
766        default,
767        skip_serializing_if = "eq_default"
768    )]
769    #[builder(default)]
770    pub supports_run_in_terminal_request: bool,
771
772    /// Client supports memory references.
773    #[serde(
774        rename = "supportsMemoryReferences",
775        default,
776        skip_serializing_if = "eq_default"
777    )]
778    #[builder(default)]
779    pub supports_memory_references: bool,
780
781    /// Client supports progress reporting.
782    #[serde(
783        rename = "supportsProgressReporting",
784        default,
785        skip_serializing_if = "eq_default"
786    )]
787    #[builder(default)]
788    pub supports_progress_reporting: bool,
789
790    /// Client supports the invalidated event.
791    #[serde(
792        rename = "supportsInvalidatedEvent",
793        default,
794        skip_serializing_if = "eq_default"
795    )]
796    #[builder(default)]
797    pub supports_invalidated_event: bool,
798
799    #[serde(skip)]
800    #[builder(default, setter(skip))]
801    private: (),
802}
803impl From<InitializeRequestArguments> for Request {
804    fn from(args: InitializeRequestArguments) -> Self {
805        Self::Initialize(args)
806    }
807}
808impl From<InitializeRequestArguments> for ProtocolMessageContent {
809    fn from(args: InitializeRequestArguments) -> Self {
810        Self::from(Request::from(args))
811    }
812}
813
814#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
815#[serde(rename_all = "lowercase")]
816pub enum PathFormat {
817    Path,
818    URI,
819}
820
821impl Default for PathFormat {
822    fn default() -> Self {
823        PathFormat::Path
824    }
825}
826
827#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
828pub struct LaunchRequestArguments {
829    /// If noDebug is true the launch request should launch the program without enabling debugging.
830    #[serde(rename = "noDebug", default, skip_serializing_if = "eq_default")]
831    #[builder(default)]
832    pub no_debug: bool,
833
834    /// Optional data from the previous, restarted session.
835    ///
836    /// The data is sent as the 'restart' attribute of the 'terminated' event.
837    ///
838    /// The client should leave the data intact.
839    #[serde(rename = "__restart", skip_serializing_if = "Option::is_none")]
840    #[builder(default)]
841    pub restart: Option<Value>,
842
843    /// Additional attributes are implementation specific.
844    #[serde(flatten)]
845    #[builder(default)]
846    pub additional_attributes: Map<String, Value>,
847
848    #[serde(skip)]
849    #[builder(default, setter(skip))]
850    private: (),
851}
852impl From<LaunchRequestArguments> for Request {
853    fn from(args: LaunchRequestArguments) -> Self {
854        Self::Launch(args)
855    }
856}
857impl From<LaunchRequestArguments> for ProtocolMessageContent {
858    fn from(args: LaunchRequestArguments) -> Self {
859        Self::from(Request::from(args))
860    }
861}
862
863#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
864pub struct ModulesRequestArguments {
865    /// The index of the first module to return; if omitted modules start at 0.
866    #[serde(rename = "startModule", default, skip_serializing_if = "eq_default")]
867    #[builder(default)]
868    pub start_module: i32,
869
870    /// The number of modules to return. If moduleCount is not specified or 0, all modules are returned.
871    #[serde(rename = "moduleCount", default, skip_serializing_if = "eq_default")]
872    #[builder(default)]
873    pub module_count: i32,
874
875    #[serde(skip)]
876    #[builder(default, setter(skip))]
877    private: (),
878}
879impl From<ModulesRequestArguments> for Request {
880    fn from(args: ModulesRequestArguments) -> Self {
881        Self::Modules(args)
882    }
883}
884impl From<ModulesRequestArguments> for ProtocolMessageContent {
885    fn from(args: ModulesRequestArguments) -> Self {
886        Self::from(Request::from(args))
887    }
888}
889
890#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
891pub struct NextRequestArguments {
892    /// Execute 'next' for this thread.
893    #[serde(rename = "threadId")]
894    pub thread_id: i32,
895
896    /// Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed.
897    #[serde(rename = "granularity", default, skip_serializing_if = "eq_default")]
898    #[builder(default)]
899    pub granularity: SteppingGranularity,
900
901    #[serde(skip)]
902    #[builder(default, setter(skip))]
903    private: (),
904}
905impl From<NextRequestArguments> for Request {
906    fn from(args: NextRequestArguments) -> Self {
907        Self::Next(args)
908    }
909}
910impl From<NextRequestArguments> for ProtocolMessageContent {
911    fn from(args: NextRequestArguments) -> Self {
912        Self::from(Request::from(args))
913    }
914}
915
916#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
917pub struct PauseRequestArguments {
918    /// Pause execution for this thread.
919    #[serde(rename = "threadId")]
920    pub thread_id: i32,
921
922    #[serde(skip)]
923    #[builder(default, setter(skip))]
924    private: (),
925}
926impl From<PauseRequestArguments> for Request {
927    fn from(args: PauseRequestArguments) -> Self {
928        Self::Pause(args)
929    }
930}
931impl From<PauseRequestArguments> for ProtocolMessageContent {
932    fn from(args: PauseRequestArguments) -> Self {
933        Self::from(Request::from(args))
934    }
935}
936
937#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
938pub struct ReadMemoryRequestArguments {
939    /// Memory reference to the base location from which data should be read.
940    #[serde(rename = "memoryReference")]
941    pub memory_reference: String,
942
943    /// Optional offset (in bytes) to be applied to the reference location before reading data. Can be negative.
944    #[serde(rename = "offset", default, skip_serializing_if = "eq_default")]
945    #[builder(default)]
946    pub offset: i32,
947
948    /// Number of bytes to read at the specified location and offset.
949    #[serde(rename = "count")]
950    pub count: i32,
951
952    #[serde(skip)]
953    #[builder(default, setter(skip))]
954    private: (),
955}
956impl From<ReadMemoryRequestArguments> for Request {
957    fn from(args: ReadMemoryRequestArguments) -> Self {
958        Self::ReadMemory(args)
959    }
960}
961impl From<ReadMemoryRequestArguments> for ProtocolMessageContent {
962    fn from(args: ReadMemoryRequestArguments) -> Self {
963        Self::from(Request::from(args))
964    }
965}
966
967#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
968pub struct RestartFrameRequestArguments {
969    /// Restart this stackframe.
970    #[serde(rename = "frameId")]
971    pub frame_id: i32,
972
973    #[serde(skip)]
974    #[builder(default, setter(skip))]
975    private: (),
976}
977impl From<RestartFrameRequestArguments> for Request {
978    fn from(args: RestartFrameRequestArguments) -> Self {
979        Self::RestartFrame(args)
980    }
981}
982impl From<RestartFrameRequestArguments> for ProtocolMessageContent {
983    fn from(args: RestartFrameRequestArguments) -> Self {
984        Self::from(Request::from(args))
985    }
986}
987
988// #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
989// pub struct RestartRequestArguments {
990//   /// The latest version of the 'launch' or 'attach' configuration.
991//   #[serde(rename="arguments", skip_serializing_if = "Option::is_none")]
992//   pub arguments: Option<TODO oneOf>,
993// }
994
995#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
996pub struct ReverseContinueRequestArguments {
997    /// Execute 'reverseContinue' for this thread.
998    #[serde(rename = "threadId")]
999    pub thread_id: i32,
1000
1001    #[serde(skip)]
1002    #[builder(default, setter(skip))]
1003    private: (),
1004}
1005impl From<ReverseContinueRequestArguments> for Request {
1006    fn from(args: ReverseContinueRequestArguments) -> Self {
1007        Self::ReverseContinue(args)
1008    }
1009}
1010impl From<ReverseContinueRequestArguments> for ProtocolMessageContent {
1011    fn from(args: ReverseContinueRequestArguments) -> Self {
1012        Self::from(Request::from(args))
1013    }
1014}
1015
1016#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1017pub struct RunInTerminalRequestArguments {
1018    /// What kind of terminal to launch.
1019    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
1020    #[builder(default)]
1021    pub kind: Option<TerminalKind>,
1022
1023    /// Optional title of the terminal.
1024    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
1025    #[builder(default)]
1026    pub title: Option<String>,
1027
1028    /// Working directory for the command. For non-empty, valid paths this typically results in execution of a change directory command.
1029    #[serde(rename = "cwd")]
1030    pub cwd: String,
1031
1032    /// List of arguments. The first argument is the command to run.
1033    #[serde(rename = "args")]
1034    pub args: Vec<String>,
1035
1036    /// Environment key-value pairs that are added to or removed from the default environment.
1037    #[serde(rename = "env", default, skip_serializing_if = "HashMap::is_empty")]
1038    #[builder(default)]
1039    pub env: HashMap<String, Option<String>>,
1040
1041    #[serde(skip)]
1042    #[builder(default, setter(skip))]
1043    private: (),
1044}
1045impl From<RunInTerminalRequestArguments> for Request {
1046    fn from(args: RunInTerminalRequestArguments) -> Self {
1047        Self::RunInTerminal(args)
1048    }
1049}
1050impl From<RunInTerminalRequestArguments> for ProtocolMessageContent {
1051    fn from(args: RunInTerminalRequestArguments) -> Self {
1052        Self::from(Request::from(args))
1053    }
1054}
1055
1056#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
1057#[serde(rename_all = "lowercase")]
1058pub enum TerminalKind {
1059    Integrated,
1060
1061    External,
1062}
1063
1064#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1065pub struct ScopesRequestArguments {
1066    /// Retrieve the scopes for this stackframe.
1067    #[serde(rename = "frameId")]
1068    pub frame_id: i32,
1069
1070    #[serde(skip)]
1071    #[builder(default, setter(skip))]
1072    private: (),
1073}
1074impl From<ScopesRequestArguments> for Request {
1075    fn from(args: ScopesRequestArguments) -> Self {
1076        Self::Scopes(args)
1077    }
1078}
1079impl From<ScopesRequestArguments> for ProtocolMessageContent {
1080    fn from(args: ScopesRequestArguments) -> Self {
1081        Self::from(Request::from(args))
1082    }
1083}
1084
1085#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1086pub struct SetBreakpointsRequestArguments {
1087    /// The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified.
1088    #[serde(rename = "source")]
1089    pub source: Source,
1090
1091    /// The code locations of the breakpoints.
1092    #[serde(rename = "breakpoints", default, skip_serializing_if = "Vec::is_empty")]
1093    #[builder(default)]
1094    pub breakpoints: Vec<SourceBreakpoint>,
1095
1096    /// Deprecated: The code locations of the breakpoints.
1097    #[serde(rename = "lines", default, skip_serializing_if = "Vec::is_empty")]
1098    #[builder(default)]
1099    pub lines: Vec<i32>,
1100
1101    /// A value of true indicates that the underlying source has been modified which results in new breakpoint locations.
1102    #[serde(rename = "sourceModified", default, skip_serializing_if = "eq_default")]
1103    #[builder(default)]
1104    pub source_modified: bool,
1105
1106    #[serde(skip)]
1107    #[builder(default, setter(skip))]
1108    private: (),
1109}
1110impl From<SetBreakpointsRequestArguments> for Request {
1111    fn from(args: SetBreakpointsRequestArguments) -> Self {
1112        Self::SetBreakpoints(args)
1113    }
1114}
1115impl From<SetBreakpointsRequestArguments> for ProtocolMessageContent {
1116    fn from(args: SetBreakpointsRequestArguments) -> Self {
1117        Self::from(Request::from(args))
1118    }
1119}
1120
1121#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1122pub struct SetDataBreakpointsRequestArguments {
1123    /// The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints.
1124    #[serde(rename = "breakpoints")]
1125    pub breakpoints: Vec<DataBreakpoint>,
1126
1127    #[serde(skip)]
1128    #[builder(default, setter(skip))]
1129    private: (),
1130}
1131impl From<SetDataBreakpointsRequestArguments> for Request {
1132    fn from(args: SetDataBreakpointsRequestArguments) -> Self {
1133        Self::SetDataBreakpoints(args)
1134    }
1135}
1136impl From<SetDataBreakpointsRequestArguments> for ProtocolMessageContent {
1137    fn from(args: SetDataBreakpointsRequestArguments) -> Self {
1138        Self::from(Request::from(args))
1139    }
1140}
1141
1142#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1143pub struct SetExceptionBreakpointsRequestArguments {
1144    /// Set of exception filters specified by their ID. The set of all possible exception filters is defined by the 'exceptionBreakpointFilters' capability. The 'filter' and 'filterOptions' sets are additive.
1145    #[serde(rename = "filters")]
1146    pub filters: Vec<String>,
1147
1148    /// Set of exception filters and their options. The set of all possible exception filters is defined by the 'exceptionBreakpointFilters' capability. This attribute is only honored by a debug adapter if the capability 'supportsExceptionFilterOptions' is true. The 'filter' and 'filterOptions' sets are additive.
1149    #[serde(
1150        rename = "filterOptions",
1151        default,
1152        skip_serializing_if = "Vec::is_empty"
1153    )]
1154    #[builder(default)]
1155    pub filter_options: Vec<ExceptionFilterOptions>,
1156
1157    /// Configuration options for selected exceptions.
1158    ///
1159    /// The attribute is only honored by a debug adapter if the capability 'supportsExceptionOptions' is true.
1160    #[serde(
1161        rename = "exceptionOptions",
1162        default,
1163        skip_serializing_if = "Vec::is_empty"
1164    )]
1165    #[builder(default)]
1166    pub exception_options: Vec<ExceptionOptions>,
1167
1168    #[serde(skip)]
1169    #[builder(default, setter(skip))]
1170    private: (),
1171}
1172impl From<SetExceptionBreakpointsRequestArguments> for Request {
1173    fn from(args: SetExceptionBreakpointsRequestArguments) -> Self {
1174        Self::SetExceptionBreakpoints(args)
1175    }
1176}
1177impl From<SetExceptionBreakpointsRequestArguments> for ProtocolMessageContent {
1178    fn from(args: SetExceptionBreakpointsRequestArguments) -> Self {
1179        Self::from(Request::from(args))
1180    }
1181}
1182
1183#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1184pub struct SetExpressionRequestArguments {
1185    /// The l-value expression to assign to.
1186    #[serde(rename = "expression")]
1187    pub expression: String,
1188
1189    /// The value expression to assign to the l-value expression.
1190    #[serde(rename = "value")]
1191    pub value: String,
1192
1193    /// Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope.
1194    #[serde(rename = "frameId", skip_serializing_if = "Option::is_none")]
1195    #[builder(default)]
1196    pub frame_id: Option<i32>,
1197
1198    /// Specifies how the resulting value should be formatted.
1199    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
1200    #[builder(default)]
1201    pub format: Option<ValueFormat>,
1202
1203    #[serde(skip)]
1204    #[builder(default, setter(skip))]
1205    private: (),
1206}
1207impl From<SetExpressionRequestArguments> for Request {
1208    fn from(args: SetExpressionRequestArguments) -> Self {
1209        Self::SetExpression(args)
1210    }
1211}
1212impl From<SetExpressionRequestArguments> for ProtocolMessageContent {
1213    fn from(args: SetExpressionRequestArguments) -> Self {
1214        Self::from(Request::from(args))
1215    }
1216}
1217
1218#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1219pub struct SetFunctionBreakpointsRequestArguments {
1220    /// The function names of the breakpoints.
1221    #[serde(rename = "breakpoints")]
1222    pub breakpoints: Vec<FunctionBreakpoint>,
1223
1224    #[serde(skip)]
1225    #[builder(default, setter(skip))]
1226    private: (),
1227}
1228impl From<SetFunctionBreakpointsRequestArguments> for Request {
1229    fn from(args: SetFunctionBreakpointsRequestArguments) -> Self {
1230        Self::SetFunctionBreakpoints(args)
1231    }
1232}
1233impl From<SetFunctionBreakpointsRequestArguments> for ProtocolMessageContent {
1234    fn from(args: SetFunctionBreakpointsRequestArguments) -> Self {
1235        Self::from(Request::from(args))
1236    }
1237}
1238
1239#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1240pub struct SetInstructionBreakpointsRequestArguments {
1241    /// The instruction references of the breakpoints
1242    #[serde(rename = "breakpoints")]
1243    pub breakpoints: Vec<InstructionBreakpoint>,
1244
1245    #[serde(skip)]
1246    #[builder(default, setter(skip))]
1247    private: (),
1248}
1249impl From<SetInstructionBreakpointsRequestArguments> for Request {
1250    fn from(args: SetInstructionBreakpointsRequestArguments) -> Self {
1251        Self::SetInstructionBreakpoints(args)
1252    }
1253}
1254impl From<SetInstructionBreakpointsRequestArguments> for ProtocolMessageContent {
1255    fn from(args: SetInstructionBreakpointsRequestArguments) -> Self {
1256        Self::from(Request::from(args))
1257    }
1258}
1259
1260#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1261pub struct SetVariableRequestArguments {
1262    /// The reference of the variable container.
1263    #[serde(rename = "variablesReference")]
1264    pub variables_reference: i32,
1265
1266    /// The name of the variable in the container.
1267    #[serde(rename = "name")]
1268    pub name: String,
1269
1270    /// The value of the variable.
1271    #[serde(rename = "value")]
1272    pub value: String,
1273
1274    /// Specifies details on how to format the response value.
1275    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
1276    #[builder(default)]
1277    pub format: Option<ValueFormat>,
1278
1279    #[serde(skip)]
1280    #[builder(default, setter(skip))]
1281    private: (),
1282}
1283impl From<SetVariableRequestArguments> for Request {
1284    fn from(args: SetVariableRequestArguments) -> Self {
1285        Self::SetVariable(args)
1286    }
1287}
1288impl From<SetVariableRequestArguments> for ProtocolMessageContent {
1289    fn from(args: SetVariableRequestArguments) -> Self {
1290        Self::from(Request::from(args))
1291    }
1292}
1293
1294#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1295pub struct SourceRequestArguments {
1296    /// Specifies the source content to load. Either source.path or source.sourceReference must be specified.
1297    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
1298    #[builder(default)]
1299    pub source: Option<Source>,
1300
1301    /// The reference to the source. This is the same as source.sourceReference.
1302    ///
1303    /// This is provided for backward compatibility since old backends do not understand the 'source' attribute.
1304    #[serde(rename = "sourceReference")]
1305    pub source_reference: i32,
1306
1307    #[serde(skip)]
1308    #[builder(default, setter(skip))]
1309    private: (),
1310}
1311impl From<SourceRequestArguments> for Request {
1312    fn from(args: SourceRequestArguments) -> Self {
1313        Self::Source(args)
1314    }
1315}
1316impl From<SourceRequestArguments> for ProtocolMessageContent {
1317    fn from(args: SourceRequestArguments) -> Self {
1318        Self::from(Request::from(args))
1319    }
1320}
1321
1322#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1323pub struct StackTraceRequestArguments {
1324    /// Retrieve the stacktrace for this thread.
1325    #[serde(rename = "threadId")]
1326    pub thread_id: i32,
1327
1328    /// The index of the first frame to return; if omitted frames start at 0.
1329    #[serde(rename = "startFrame", default, skip_serializing_if = "eq_default")]
1330    #[builder(default)]
1331    pub start_frame: i32,
1332
1333    /// The maximum number of frames to return. If levels is not specified or 0, all frames are returned.
1334    #[serde(rename = "levels", default, skip_serializing_if = "eq_default")]
1335    #[builder(default)]
1336    pub levels: i32,
1337
1338    /// Specifies details on how to format the stack frames.
1339    ///
1340    /// The attribute is only honored by a debug adapter if the capability 'supportsValueFormattingOptions' is true.
1341    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
1342    #[builder(default)]
1343    pub format: Option<StackFrameFormat>,
1344
1345    #[serde(skip)]
1346    #[builder(default, setter(skip))]
1347    private: (),
1348}
1349impl From<StackTraceRequestArguments> for Request {
1350    fn from(args: StackTraceRequestArguments) -> Self {
1351        Self::StackTrace(args)
1352    }
1353}
1354impl From<StackTraceRequestArguments> for ProtocolMessageContent {
1355    fn from(args: StackTraceRequestArguments) -> Self {
1356        Self::from(Request::from(args))
1357    }
1358}
1359
1360#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1361pub struct StepBackRequestArguments {
1362    /// Execute 'stepBack' for this thread.
1363    #[serde(rename = "threadId")]
1364    pub thread_id: i32,
1365
1366    /// Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed.
1367    #[serde(rename = "granularity", default, skip_serializing_if = "eq_default")]
1368    #[builder(default)]
1369    pub granularity: SteppingGranularity,
1370
1371    #[serde(skip)]
1372    #[builder(default, setter(skip))]
1373    private: (),
1374}
1375impl From<StepBackRequestArguments> for Request {
1376    fn from(args: StepBackRequestArguments) -> Self {
1377        Self::StepBack(args)
1378    }
1379}
1380impl From<StepBackRequestArguments> for ProtocolMessageContent {
1381    fn from(args: StepBackRequestArguments) -> Self {
1382        Self::from(Request::from(args))
1383    }
1384}
1385
1386#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1387pub struct StepInRequestArguments {
1388    /// Execute 'stepIn' for this thread.
1389    #[serde(rename = "threadId")]
1390    pub thread_id: i32,
1391
1392    /// Optional id of the target to step into.
1393    #[serde(rename = "targetId", skip_serializing_if = "Option::is_none")]
1394    #[builder(default)]
1395    pub target_id: Option<i32>,
1396
1397    /// Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed.
1398    #[serde(rename = "granularity", default, skip_serializing_if = "eq_default")]
1399    #[builder(default)]
1400    pub granularity: SteppingGranularity,
1401
1402    #[serde(skip)]
1403    #[builder(default, setter(skip))]
1404    private: (),
1405}
1406impl From<StepInRequestArguments> for Request {
1407    fn from(args: StepInRequestArguments) -> Self {
1408        Self::StepIn(args)
1409    }
1410}
1411impl From<StepInRequestArguments> for ProtocolMessageContent {
1412    fn from(args: StepInRequestArguments) -> Self {
1413        Self::from(Request::from(args))
1414    }
1415}
1416
1417#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1418pub struct StepInTargetsRequestArguments {
1419    /// The stack frame for which to retrieve the possible stepIn targets.
1420    #[serde(rename = "frameId")]
1421    pub frame_id: i32,
1422
1423    #[serde(skip)]
1424    #[builder(default, setter(skip))]
1425    private: (),
1426}
1427impl From<StepInTargetsRequestArguments> for Request {
1428    fn from(args: StepInTargetsRequestArguments) -> Self {
1429        Self::StepInTargets(args)
1430    }
1431}
1432impl From<StepInTargetsRequestArguments> for ProtocolMessageContent {
1433    fn from(args: StepInTargetsRequestArguments) -> Self {
1434        Self::from(Request::from(args))
1435    }
1436}
1437
1438#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1439pub struct StepOutRequestArguments {
1440    /// Execute 'stepOut' for this thread.
1441    #[serde(rename = "threadId")]
1442    pub thread_id: i32,
1443
1444    /// Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed.
1445    #[serde(rename = "granularity", default, skip_serializing_if = "eq_default")]
1446    #[builder(default)]
1447    pub granularity: SteppingGranularity,
1448
1449    #[serde(skip)]
1450    #[builder(default, setter(skip))]
1451    private: (),
1452}
1453impl From<StepOutRequestArguments> for Request {
1454    fn from(args: StepOutRequestArguments) -> Self {
1455        Self::StepOut(args)
1456    }
1457}
1458impl From<StepOutRequestArguments> for ProtocolMessageContent {
1459    fn from(args: StepOutRequestArguments) -> Self {
1460        Self::from(Request::from(args))
1461    }
1462}
1463
1464#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1465pub struct TerminateRequestArguments {
1466    /// A value of true indicates that this 'terminate' request is part of a restart sequence.
1467    #[serde(rename = "restart", default, skip_serializing_if = "eq_default")]
1468    #[builder(default)]
1469    pub restart: bool,
1470
1471    #[serde(skip)]
1472    #[builder(default, setter(skip))]
1473    private: (),
1474}
1475impl From<TerminateRequestArguments> for Request {
1476    fn from(args: TerminateRequestArguments) -> Self {
1477        Self::Terminate(args)
1478    }
1479}
1480impl From<TerminateRequestArguments> for ProtocolMessageContent {
1481    fn from(args: TerminateRequestArguments) -> Self {
1482        Self::from(Request::from(args))
1483    }
1484}
1485
1486#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1487pub struct TerminateThreadsRequestArguments {
1488    /// Ids of threads to be terminated.
1489    #[serde(rename = "threadIds", default, skip_serializing_if = "Vec::is_empty")]
1490    #[builder(default)]
1491    pub thread_ids: Vec<i32>,
1492
1493    #[serde(skip)]
1494    #[builder(default, setter(skip))]
1495    private: (),
1496}
1497impl From<TerminateThreadsRequestArguments> for Request {
1498    fn from(args: TerminateThreadsRequestArguments) -> Self {
1499        Self::TerminateThreads(args)
1500    }
1501}
1502impl From<TerminateThreadsRequestArguments> for ProtocolMessageContent {
1503    fn from(args: TerminateThreadsRequestArguments) -> Self {
1504        Self::from(Request::from(args))
1505    }
1506}
1507
1508#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, TypedBuilder)]
1509pub struct VariablesRequestArguments {
1510    /// The Variable reference.
1511    #[serde(rename = "variablesReference")]
1512    pub variables_reference: i32,
1513
1514    /// Optional filter to limit the child variables to either named or indexed. If omitted, both types are fetched.
1515    #[serde(rename = "filter", skip_serializing_if = "Option::is_none")]
1516    #[builder(default)]
1517    pub filter: Option<VariablesFilter>,
1518
1519    /// The index of the first variable to return; if omitted children start at 0.
1520    #[serde(rename = "start", default, skip_serializing_if = "eq_default")]
1521    #[builder(default)]
1522    pub start: i32,
1523
1524    /// The number of variables to return. If count is missing or 0, all variables are returned.
1525    #[serde(rename = "count", default, skip_serializing_if = "eq_default")]
1526    #[builder(default)]
1527    pub count: i32,
1528
1529    /// Specifies details on how to format the Variable values.
1530    ///
1531    /// The attribute is only honored by a debug adapter if the capability 'supportsValueFormattingOptions' is true.
1532    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
1533    #[builder(default)]
1534    pub format: Option<ValueFormat>,
1535
1536    #[serde(skip)]
1537    #[builder(default, setter(skip))]
1538    private: (),
1539}
1540impl From<VariablesRequestArguments> for Request {
1541    fn from(args: VariablesRequestArguments) -> Self {
1542        Self::Variables(args)
1543    }
1544}
1545impl From<VariablesRequestArguments> for ProtocolMessageContent {
1546    fn from(args: VariablesRequestArguments) -> Self {
1547        Self::from(Request::from(args))
1548    }
1549}
1550
1551#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
1552#[serde(rename_all = "lowercase")]
1553pub enum VariablesFilter {
1554    Indexed,
1555
1556    Named,
1557}