on master help sign in
Disable continuing when running
commitf3e47bfee4d70cfc350035f29cc7e20b6ce725e8 authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateSat 21 Aug 2021, 20:55 (5 years ago) parent5230a2b
3 files changed+15
helix-dap/src/client.rs+2 helix-term/src/application.rs+1 helix-term/src/commands.rs+12
helix-dap/src/client.rs+2
@@ -30,6 +30,7 @@ pub struct Client {
3030 pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>,
3131 // TODO: multiple threads support
3232 pub stack_pointer: Option<StackFrame>,
33+ pub is_running: bool,
3334}
3435
3536impl Client {
@@ -51,6 +52,7 @@ impl Client {
5152 //
5253 breakpoints: HashMap::new(),
5354 stack_pointer: None,
55+ is_running: false,
5456 };
5557
5658 tokio::spawn(Self::recv(server_rx, client_rx));
helix-term/src/application.rs+1
@@ -195,6 +195,7 @@ impl Application {
195195 Payload::Event(ev) => {
196196 match &ev.event[..] {
197197 "stopped" => {
198+ debugger.is_running = false;
198199 let main = debugger
199200 .threads()
200201 .await
helix-term/src/commands.rs+12
@@ -4319,8 +4319,14 @@ fn dap_run(cx: &mut Context) {
43194319 use helix_lsp::block_on;
43204320
43214321 if let Some(debugger) = &mut cx.editor.debugger {
4322+ if debugger.is_running {
4323+ cx.editor
4324+ .set_status("Debuggee is already running".to_owned());
4325+ return;
4326+ }
43224327 let request = debugger.configuration_done();
43234328 let _ = block_on(request).unwrap();
4329+ debugger.is_running = true;
43244330 }
43254331}
43264332
@@ -4328,10 +4334,16 @@ fn dap_continue(cx: &mut Context) {
43284334 use helix_lsp::block_on;
43294335
43304336 if let Some(debugger) = &mut cx.editor.debugger {
4337+ if debugger.is_running {
4338+ cx.editor
4339+ .set_status("Debuggee is already running".to_owned());
4340+ return;
4341+ }
43314342 // assume 0 to continue all threads for now
43324343 // FIXME: spec conformant behavior here
43334344 let request = debugger.continue_thread(0);
43344345 let _ = block_on(request).unwrap();
4346+ debugger.is_running = true;
43354347 }
43364348}
43374349