on master help sign in
dap: Avoid cloning *entire* stack frames when picking a thread
commit757babb1b4390a7446a2a4f3efb1d9302961a1f6 authorBlaž Hrastnik <blaz@mxxn.io> dateSun 7 Nov 2021, 18:56 (5 years ago) parent5803de2
1 file changed+8−3
helix-term/src/commands/dap.rs+8−3
helix-term/src/commands/dap.rs+8−3
@@ -115,7 +115,6 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
115115 }
116116
117117 let thread_states = debugger.thread_states.clone();
118− let frames = debugger.stack_frames.clone();
119118 let picker = FilePicker::new(
120119 threads,
121120 move |thread| {
@@ -129,8 +128,14 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
129128 .into()
130129 },
131130 move |cx, thread, _action| callback_fn(cx.editor, thread),
132− move |_editor, thread| {
133− if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) {
131+ move |editor, thread| {
132+ let frame = editor
133+ .debugger
134+ .as_ref()
135+ .and_then(|debugger| debugger.stack_frames.get(&thread.id))
136+ .and_then(|bt| bt.get(0));
137+
138+ if let Some(frame) = frame {
134139 frame
135140 .source
136141 .as_ref()