aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-21 14:21:35 +0000
committerDmitry Sharshakov2021-08-21 14:21:35 +0000
commita938f5a87a2b67dd8667337cd569cc6627d0f666 (patch)
treeecce252fd9c451f23c583bb734dc9912d39c13e7 /helix-term/src/application.rs
parent3fc501c99f8f8c539dc4714a200bac45a7169138 (diff)
refactor: handle DAP events in editor main loop
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 011dafee..dad6df2b 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -1,4 +1,5 @@
use helix_core::syntax;
+use helix_dap::Payload;
use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
use helix_view::{theme, Editor};
@@ -184,6 +185,29 @@ impl Application {
last_render = Instant::now();
}
}
+ Some(payload) = self.editor.debugger_events.next() => {
+ let mut debugger = self.editor.debugger.as_mut().unwrap();
+ match payload {
+ Payload::Event(ev) => {
+ match &ev.event[..] {
+ "stopped" => {
+ let main = debugger
+ .threads()
+ .await
+ .ok()
+ .and_then(|threads| threads.get(0).cloned());
+ if let Some(main) = main {
+ let (bt, _) = debugger.stack_trace(main.id).await.unwrap();
+ debugger.stack_pointer = bt.get(0).cloned();
+ }
+ }
+ _ => {}
+ }
+ },
+ Payload::Response(_) => unreachable!(),
+ Payload::Request(_) => todo!(),
+ }
+ }
Some(callback) = self.jobs.futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render();