on master help sign in
Disable continuing when running
f3e47bfDmitry Sharshakov
helix-dap/src/client.rs+2
@@ -30,6 +30,7 @@ pub struct Client {
30 pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>,
30 pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>,
31 // TODO: multiple threads support
31 // TODO: multiple threads support
32 pub stack_pointer: Option<StackFrame>,
32 pub stack_pointer: Option<StackFrame>,
33+ pub is_running: bool,
33}
34}
34
35
35impl Client {
36impl Client {
@@ -51,6 +52,7 @@ impl Client {
51 //
52 //
52 breakpoints: HashMap::new(),
53 breakpoints: HashMap::new(),
53 stack_pointer: None,
54 stack_pointer: None,
55+ is_running: false,
54 };
56 };
55
57
56 tokio::spawn(Self::recv(server_rx, client_rx));
58 tokio::spawn(Self::recv(server_rx, client_rx));
helix-term/src/application.rs+1
@@ -195,6 +195,7 @@ impl Application {
195 Payload::Event(ev) => {
195 Payload::Event(ev) => {
196 match &ev.event[..] {
196 match &ev.event[..] {
197 "stopped" => {
197 "stopped" => {
198+ debugger.is_running = false;
198 let main = debugger
199 let main = debugger
199 .threads()
200 .threads()
200 .await
201 .await
helix-term/src/commands.rs+12
@@ -4319,8 +4319,14 @@ fn dap_run(cx: &mut Context) {
4319 use helix_lsp::block_on;
4319 use helix_lsp::block_on;
4320
4320
4321 if let Some(debugger) = &mut cx.editor.debugger {
4321 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+ }
4322 let request = debugger.configuration_done();
4327 let request = debugger.configuration_done();
4323 let _ = block_on(request).unwrap();
4328 let _ = block_on(request).unwrap();
4329+ debugger.is_running = true;
4324 }
4330 }
4325}
4331}
4326
4332
@@ -4328,10 +4334,16 @@ fn dap_continue(cx: &mut Context) {
4328 use helix_lsp::block_on;
4334 use helix_lsp::block_on;
4329
4335
4330 if let Some(debugger) = &mut cx.editor.debugger {
4336 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+ }
4331 // assume 0 to continue all threads for now
4342 // assume 0 to continue all threads for now
4332 // FIXME: spec conformant behavior here
4343 // FIXME: spec conformant behavior here
4333 let request = debugger.continue_thread(0);
4344 let request = debugger.continue_thread(0);
4334 let _ = block_on(request).unwrap();
4345 let _ = block_on(request).unwrap();
4346+ debugger.is_running = true;
4335 }
4347 }
4336}
4348}
4337
4349