show thread states in thread picker

This commit is contained in:
Dmitry Sharshakov 2021-09-04 10:14:04 +03:00
parent 00cccdc62a
commit 9a1916ebfd

View file

@ -102,10 +102,20 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
return; return;
} }
let thread_states = debugger.thread_states.clone();
let picker = Picker::new( let picker = Picker::new(
true, true,
threads, threads,
|thread| thread.name.clone().into(), // TODO: include thread_states in the label move |thread| {
format!(
"{} ({})",
thread.name,
thread_states
.get(&thread.id)
.unwrap_or(&"unknown".to_owned())
)
.into()
},
move |editor, thread, _action| callback_fn(editor, thread), move |editor, thread, _action| callback_fn(editor, thread),
); );
cx.push_layer(Box::new(picker)) cx.push_layer(Box::new(picker))