summaryrefslogtreecommitdiff
path: root/helix-term/src/commands
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-03 02:30:25 +0000
committerBlaž Hrastnik2021-09-03 02:30:25 +0000
commit27c1b3f98b58edf690fda7caa2b14f34d6661598 (patch)
tree59963ef8b67df8f067c591e2aa83da3134d4cbce /helix-term/src/commands
parent5b920c53f0b2cb1d6f48ffa46659c65f7fb6fde5 (diff)
dap: Extract a thread_states map
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r--helix-term/src/commands/dap.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index 7efc2c74..37f87711 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -19,7 +19,10 @@ pub fn dap_pos_to_pos(doc: &helix_core::Rope, line: usize, column: usize) -> Opt
}
pub fn resume_application(debugger: &mut Client) {
- debugger.is_running = true; // TODO: set state running for debugger.thread_id
+ if let Some(thread_id) = debugger.thread_id {
+ debugger.thread_states.insert(thread_id, "running".to_string());
+ debugger.stack_frames.remove(&thread_id);
+ }
debugger.active_frame = None;
debugger.thread_id = None;
}
@@ -302,7 +305,6 @@ pub fn dap_continue(cx: &mut Context) {
return;
}
resume_application(debugger);
- debugger.stack_frames.remove(&thread_id);
} else {
cx.editor
.set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -315,6 +317,8 @@ pub fn dap_pause(cx: &mut Context) {
None => return,
};
+ // TODO: this should instead open a picker to pause a selected thread
+
if !debugger.is_running {
cx.editor.set_status("Debuggee is not running".to_owned());
return;
@@ -340,7 +344,6 @@ pub fn dap_step_in(cx: &mut Context) {
return;
}
resume_application(debugger);
- debugger.stack_frames.remove(&thread_id);
} else {
cx.editor
.set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -360,7 +363,6 @@ pub fn dap_step_out(cx: &mut Context) {
return;
}
resume_application(debugger);
- debugger.stack_frames.remove(&thread_id);
} else {
cx.editor
.set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -380,7 +382,6 @@ pub fn dap_next(cx: &mut Context) {
return;
}
resume_application(debugger);
- debugger.stack_frames.remove(&thread_id);
} else {
cx.editor
.set_error("Currently active thread is not stopped. Switch the thread.".into());
@@ -393,7 +394,7 @@ pub fn dap_variables(cx: &mut Context) {
None => return,
};
- if debugger.is_running {
+ if debugger.thread_id.is_none() {
cx.editor
.set_status("Cannot access variables while target is running".to_owned());
return;