summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs17
-rw-r--r--helix-term/src/commands/dap.rs17
2 files changed, 23 insertions, 11 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 802438bc..ce6cc76b 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -3,7 +3,9 @@ use helix_dap::Payload;
use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
use helix_view::{theme, Editor};
-use crate::{args::Args, compositor::Compositor, config::Config, job::Jobs, ui};
+use crate::{
+ args::Args, commands::fetch_stack_trace, compositor::Compositor, config::Config, job::Jobs, ui,
+};
use log::error;
use std::{
@@ -273,7 +275,16 @@ impl Application {
all_threads_stopped,
..
}) => {
- if let Some(thread_id) = thread_id {
+ let all_threads_stopped = all_threads_stopped.unwrap_or_default();
+
+ if all_threads_stopped {
+ if let Ok(threads) = debugger.threads().await {
+ for thread in threads {
+ fetch_stack_trace(debugger, thread.id).await;
+ }
+ select_thread_id(&mut self.editor, thread_id.unwrap_or(0), false).await;
+ }
+ } else if let Some(thread_id) = thread_id {
debugger.thread_states.insert(thread_id, reason.clone()); // TODO: dap uses "type" || "reason" here
// whichever thread stops is made "current" (if no previously selected thread).
@@ -292,7 +303,7 @@ impl Application {
if let Some(text) = text {
status.push_str(&format!(" {}", text));
}
- if all_threads_stopped.unwrap_or_default() {
+ if all_threads_stopped {
status.push_str(" (all threads stopped)");
}
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index 14c040df..61b1f438 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -45,20 +45,21 @@ pub async fn select_thread_id(editor: &mut Editor, thread_id: isize, force: bool
}
debugger.thread_id = Some(thread_id);
+ fetch_stack_trace(debugger, thread_id).await;
- // fetch stack trace
- // TODO: handle requesting more total frames
+ let frame = debugger.stack_frames[&thread_id].get(0).cloned();
+ if let Some(frame) = &frame {
+ jump_to_stack_frame(editor, frame);
+ }
+}
+
+pub async fn fetch_stack_trace(debugger: &mut Client, thread_id: isize) {
let (frames, _) = match debugger.stack_trace(thread_id).await {
Ok(frames) => frames,
Err(_) => return,
};
debugger.stack_frames.insert(thread_id, frames);
- debugger.active_frame = Some(0); // TODO: check how to determine this
-
- let frame = debugger.stack_frames[&thread_id].get(0).cloned();
- if let Some(frame) = &frame {
- jump_to_stack_frame(editor, frame);
- }
+ debugger.active_frame = Some(0);
}
pub fn jump_to_stack_frame(editor: &mut Editor, frame: &helix_dap::StackFrame) {