diff options
author | Dmitry Sharshakov | 2021-09-05 12:19:52 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-09-05 12:19:52 +0000 |
commit | 9b8c5bdade72062329a536a1c956de68ad9eccd2 (patch) | |
tree | f1fba71d792bfa0672a3dcd77ab21ac0900b1122 | |
parent | 0add0c563903356280af8e82aefa687c2c626ebe (diff) |
Remove redundant fetching of stack traces
-rw-r--r-- | helix-term/src/commands/dap.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index ab65dd49..b4cefbfc 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -112,16 +112,7 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa } let thread_states = debugger.thread_states.clone(); - let mut top_frames: HashMap<isize, StackFrame> = HashMap::new(); - for thread in threads.clone() { - if let Some(frame) = block_on(debugger.stack_trace(thread.id)) - .ok() - .and_then(|(bt, _)| bt.get(0).cloned()) - { - top_frames.insert(thread.id, frame); - } - } - + let frames = debugger.stack_frames.clone(); let picker = FilePicker::new( threads, move |thread| { @@ -136,7 +127,7 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa }, move |editor, thread, _action| callback_fn(editor, thread), move |_editor, thread| { - if let Some(frame) = top_frames.get(&thread.id) { + if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) { frame .source .as_ref() |