aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-21 17:55:45 +0000
committerDmitry Sharshakov2021-08-21 17:55:45 +0000
commitf3e47bfee4d70cfc350035f29cc7e20b6ce725e8 (patch)
treee7e1b692923dd891e8edd9715497f0718defe135
parent5230a2b6698ee4d8dc69a7855b046a887bfefcff (diff)
Disable continuing when running
-rw-r--r--helix-dap/src/client.rs2
-rw-r--r--helix-term/src/application.rs1
-rw-r--r--helix-term/src/commands.rs12
3 files changed, 15 insertions, 0 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs
index bc7a93d8..cfb278a9 100644
--- a/helix-dap/src/client.rs
+++ b/helix-dap/src/client.rs
@@ -30,6 +30,7 @@ pub struct Client {
pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>,
// TODO: multiple threads support
pub stack_pointer: Option<StackFrame>,
+ pub is_running: bool,
}
impl Client {
@@ -51,6 +52,7 @@ impl Client {
//
breakpoints: HashMap::new(),
stack_pointer: None,
+ is_running: false,
};
tokio::spawn(Self::recv(server_rx, client_rx));
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index d65610ef..a9aafad2 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -195,6 +195,7 @@ impl Application {
Payload::Event(ev) => {
match &ev.event[..] {
"stopped" => {
+ debugger.is_running = false;
let main = debugger
.threads()
.await
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index dc8d02ac..9e34df54 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -4319,8 +4319,14 @@ fn dap_run(cx: &mut Context) {
use helix_lsp::block_on;
if let Some(debugger) = &mut cx.editor.debugger {
+ if debugger.is_running {
+ cx.editor
+ .set_status("Debuggee is already running".to_owned());
+ return;
+ }
let request = debugger.configuration_done();
let _ = block_on(request).unwrap();
+ debugger.is_running = true;
}
}
@@ -4328,10 +4334,16 @@ fn dap_continue(cx: &mut Context) {
use helix_lsp::block_on;
if let Some(debugger) = &mut cx.editor.debugger {
+ if debugger.is_running {
+ cx.editor
+ .set_status("Debuggee is already running".to_owned());
+ return;
+ }
// assume 0 to continue all threads for now
// FIXME: spec conformant behavior here
let request = debugger.continue_thread(0);
let _ = block_on(request).unwrap();
+ debugger.is_running = true;
}
}