dap: Simplify a few more statements that could use the debugger macro
This commit is contained in:
parent
d8351d35ab
commit
60c86eff89
1 changed files with 4 additions and 13 deletions
|
@ -124,10 +124,7 @@ fn thread_picker(
|
||||||
callback_fn(editor, &threads[0]);
|
callback_fn(editor, &threads[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let debugger = match &mut editor.debugger {
|
let debugger = debugger!(editor);
|
||||||
Some(debugger) => debugger,
|
|
||||||
None => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
let thread_states = debugger.thread_states.clone();
|
let thread_states = debugger.thread_states.clone();
|
||||||
let picker = FilePicker::new(
|
let picker = FilePicker::new(
|
||||||
|
@ -535,10 +532,7 @@ pub fn dap_continue(cx: &mut Context) {
|
||||||
|
|
||||||
pub fn dap_pause(cx: &mut Context) {
|
pub fn dap_pause(cx: &mut Context) {
|
||||||
thread_picker(cx, |editor, thread| {
|
thread_picker(cx, |editor, thread| {
|
||||||
let debugger = match &mut editor.debugger {
|
let debugger = debugger!(editor);
|
||||||
Some(debugger) => debugger,
|
|
||||||
None => return,
|
|
||||||
};
|
|
||||||
let request = debugger.pause(thread.id);
|
let request = debugger.pause(thread.id);
|
||||||
// NOTE: we don't need to set active thread id here because DAP will emit a "stopped" event
|
// NOTE: we don't need to set active thread id here because DAP will emit a "stopped" event
|
||||||
if let Err(e) = block_on(request) {
|
if let Err(e) = block_on(request) {
|
||||||
|
@ -670,7 +664,7 @@ pub fn dap_enable_exceptions(cx: &mut Context) {
|
||||||
pub fn dap_disable_exceptions(cx: &mut Context) {
|
pub fn dap_disable_exceptions(cx: &mut Context) {
|
||||||
let debugger = debugger!(cx.editor);
|
let debugger = debugger!(cx.editor);
|
||||||
|
|
||||||
if let Err(e) = block_on(debugger.set_exception_breakpoints(vec![])) {
|
if let Err(e) = block_on(debugger.set_exception_breakpoints(Vec::new())) {
|
||||||
cx.editor
|
cx.editor
|
||||||
.set_error(format!("Failed to set up exception breakpoints: {}", e));
|
.set_error(format!("Failed to set up exception breakpoints: {}", e));
|
||||||
}
|
}
|
||||||
|
@ -787,10 +781,7 @@ pub fn dap_switch_stack_frame(cx: &mut Context) {
|
||||||
frames,
|
frames,
|
||||||
|frame| frame.name.clone().into(), // TODO: include thread_states in the label
|
|frame| frame.name.clone().into(), // TODO: include thread_states in the label
|
||||||
move |cx, frame, _action| {
|
move |cx, frame, _action| {
|
||||||
let debugger = match &mut cx.editor.debugger {
|
let debugger = debugger!(cx.editor);
|
||||||
Some(debugger) => debugger,
|
|
||||||
None => return,
|
|
||||||
};
|
|
||||||
// TODO: this should be simpler to find
|
// TODO: this should be simpler to find
|
||||||
let pos = debugger.stack_frames[&thread_id]
|
let pos = debugger.stack_frames[&thread_id]
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Add table
Reference in a new issue