on master help sign in
dap: Avoid cloning *entire* stack frames when picking a thread
757babbBlaž Hrastnik
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
115 }
115 }
116
116
117 let thread_states = debugger.thread_states.clone();
117 let thread_states = debugger.thread_states.clone();
118− let frames = debugger.stack_frames.clone();
119 let picker = FilePicker::new(
118 let picker = FilePicker::new(
120 threads,
119 threads,
121 move |thread| {
120 move |thread| {
@@ -129,8 +128,14 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
129 .into()
128 .into()
130 },
129 },
131 move |cx, thread, _action| callback_fn(cx.editor, thread),
130 move |cx, thread, _action| callback_fn(cx.editor, thread),
132− move |_editor, thread| {
131+ move |editor, thread| {
132+ let frame = editor
133+ .debugger
134+ .as_ref()
135+ .and_then(|debugger| debugger.stack_frames.get(&thread.id))
133− if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) {
136+ .and_then(|bt| bt.get(0));
137+
138+ if let Some(frame) = frame {
134 frame
139 frame
135 .source
140 .source
136 .as_ref()
141 .as_ref()