mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-11-29 13:32:09 +03:00
find main thread automatically if thread stopped is not known
This commit is contained in:
parent
5b20f6020a
commit
e0180a4b88
@ -276,8 +276,21 @@ impl Application {
|
||||
debugger.is_running = false;
|
||||
|
||||
// whichever thread stops is made "current" (if no previously selected thread).
|
||||
if let Some(thread_id) = thread_id {
|
||||
select_thread_id(&mut self.editor, thread_id, false).await;
|
||||
if thread_id.is_none() || all_threads_stopped.unwrap_or_default() {
|
||||
let main = debugger.threads().await.ok().and_then(|threads| {
|
||||
// Workaround for debugging Go tests. Main thread has * in beginning of its name
|
||||
let mut main =
|
||||
threads.iter().find(|t| t.name.starts_with('*')).cloned();
|
||||
if main.is_none() {
|
||||
main = threads.get(0).cloned();
|
||||
}
|
||||
main.map(|t| t.id)
|
||||
});
|
||||
if let Some(id) = main {
|
||||
select_thread_id(&mut self.editor, id, false).await;
|
||||
}
|
||||
} else {
|
||||
select_thread_id(&mut self.editor, thread_id.unwrap(), false).await;
|
||||
}
|
||||
|
||||
let scope = match thread_id {
|
||||
|
Loading…
Reference in New Issue
Block a user