1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
use serde_json::Value;

use crate::models::{Breakpoint, Capabilities, Source};

mod impls;

#[cfg(test)]
mod tests;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BreakpointReason {
    Changed,
    New,
    Removed,
    Custom(String),
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StoppedReason {
    Step,
    Breakpoint,
    Exception,
    Pause,
    Entry,
    Goto,
    FunctionBreakpoint,
    DataBreakpoint,
    InstructionBreakpoint,
    Custom(String),
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ThreadReason {
    Started,
    Exited,
    Custom(String),
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OutputCategory {
    Console,
    Important,
    Stdout,
    Stderr,
    Telemetry,
    Custom(String),
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OutputGroup {
    Start,
    StartCollapsed,
    End,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LoadedSourceReason {
    New,
    Changed,
    Removed,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProcessStartMethod {
    Launch,
    Attach,
    AttachForSuspendedLaunch,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Event {
    Breakpoint {
        reason: BreakpointReason,
        breakpoint: Breakpoint,
    },
    Capabilities {
        capabilities: Capabilities,
    },
    Continued {
        thread_id: u64,
        all_threads_continued: bool,
    },
    Exited {
        exit_code: u64,
    },
    Initialized,
    LoadedSource {
        reason: LoadedSourceReason,
        source: Source,
    },
    Output {
        category: Option<OutputCategory>,
        output: String,
        group: Option<OutputGroup>,
        variables_reference: Option<u32>,
        source: Option<Source>,
        line: Option<u64>,
        column: Option<u64>,
        data: Option<Value>,
    },
    Process {
        name: String,
        system_process_id: Option<u64>,
        is_local_process: bool,
        start_method: Option<ProcessStartMethod>,
        pointer_size: Option<u64>,
    },
    Stopped {
        reason: StoppedReason,
        description: Option<String>,
        thread_id: Option<u64>,
        preserve_focus_hint: bool,
        text: Option<String>,
        all_threads_stopped: bool,
        hit_breakpoint_ids: Vec<usize>,
    },
    Terminated {
        restart: Option<Value>,
    },
    Thread {
        reason: ThreadReason,
        thread_id: u64,
    },
    Custom {
        body: Option<Value>,
    },
}