diff options
author | Blaž Hrastnik | 2021-11-07 09:56:09 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-07 09:56:09 +0000 |
commit | 757babb1b4390a7446a2a4f3efb1d9302961a1f6 (patch) | |
tree | 7c865dd12edbfab98f3dde4d82b5ec7d4aa06533 /helix-term/src | |
parent | 5803de2067db228257ac3eb028af1a783d1243fb (diff) |
dap: Avoid cloning *entire* stack frames when picking a thread
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands/dap.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 5c45b2d6..57459779 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -115,7 +115,6 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa } let thread_states = debugger.thread_states.clone(); - let frames = debugger.stack_frames.clone(); let picker = FilePicker::new( threads, move |thread| { @@ -129,8 +128,14 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa .into() }, move |cx, thread, _action| callback_fn(cx.editor, thread), - move |_editor, thread| { - if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) { + move |editor, thread| { + let frame = editor + .debugger + .as_ref() + .and_then(|debugger| debugger.stack_frames.get(&thread.id)) + .and_then(|bt| bt.get(0)); + + if let Some(frame) = frame { frame .source .as_ref() |