Skip to main content

mq_dap/
protocol.rs

1use serde::{Deserialize, Serialize};
2
3/// Messages sent from the debugger handler to the DAP server
4#[derive(Debug, Clone)]
5pub enum DebuggerMessage {
6    /// A breakpoint was hit, should send stopped event
7    BreakpointHit {
8        thread_id: i64,
9        line: usize,
10        breakpoint: mq_lang::Breakpoint,
11        context: mq_lang::DebugContext,
12    },
13    /// A step operation completed, should send stopped event
14    StepCompleted {
15        thread_id: i64,
16        line: usize,
17        context: mq_lang::DebugContext,
18    },
19    /// Program was paused by user request, should send stopped event
20    Paused {
21        thread_id: i64,
22        line: usize,
23        context: mq_lang::DebugContext,
24    },
25    /// Program has terminated
26    Terminated,
27}
28
29/// Messages sent from the DAP server to the debugger handler
30#[derive(Debug, Clone)]
31pub enum DapCommand {
32    /// Continue execution
33    Continue,
34    /// Step to next line
35    Next,
36    /// Step into function
37    StepIn,
38    /// Step out of function
39    StepOut,
40    /// Pause execution
41    Pause,
42    /// Terminate debugging session
43    Terminate,
44}
45
46/// Launch arguments for DAP launch configuration
47#[derive(Deserialize, Serialize, Debug)]
48#[serde(rename_all = "camelCase")]
49pub struct LaunchArgs {
50    pub query_file: String,
51    pub input_file: Option<String>,
52}