Disable continuing when running

pull/574/head
Dmitry Sharshakov 3 years ago
parent 5230a2b669
commit f3e47bfee4
No known key found for this signature in database
GPG Key ID: 471FD32E15FD8473

@ -30,6 +30,7 @@ pub struct Client {
pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>, pub breakpoints: HashMap<PathBuf, Vec<SourceBreakpoint>>,
// TODO: multiple threads support // TODO: multiple threads support
pub stack_pointer: Option<StackFrame>, pub stack_pointer: Option<StackFrame>,
pub is_running: bool,
} }
impl Client { impl Client {
@ -51,6 +52,7 @@ impl Client {
// //
breakpoints: HashMap::new(), breakpoints: HashMap::new(),
stack_pointer: None, stack_pointer: None,
is_running: false,
}; };
tokio::spawn(Self::recv(server_rx, client_rx)); tokio::spawn(Self::recv(server_rx, client_rx));

@ -195,6 +195,7 @@ impl Application {
Payload::Event(ev) => { Payload::Event(ev) => {
match &ev.event[..] { match &ev.event[..] {
"stopped" => { "stopped" => {
debugger.is_running = false;
let main = debugger let main = debugger
.threads() .threads()
.await .await

@ -4319,8 +4319,14 @@ fn dap_run(cx: &mut Context) {
use helix_lsp::block_on; use helix_lsp::block_on;
if let Some(debugger) = &mut cx.editor.debugger { 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 request = debugger.configuration_done();
let _ = block_on(request).unwrap(); let _ = block_on(request).unwrap();
debugger.is_running = true;
} }
} }
@ -4328,10 +4334,16 @@ fn dap_continue(cx: &mut Context) {
use helix_lsp::block_on; use helix_lsp::block_on;
if let Some(debugger) = &mut cx.editor.debugger { 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 // assume 0 to continue all threads for now
// FIXME: spec conformant behavior here // FIXME: spec conformant behavior here
let request = debugger.continue_thread(0); let request = debugger.continue_thread(0);
let _ = block_on(request).unwrap(); let _ = block_on(request).unwrap();
debugger.is_running = true;
} }
} }

Loading…
Cancel
Save