debugger: Add ability to only show stack frame entries from visible work trees (#37061)
This PR adds a toggleable filter to the stack frame list that filters out entries that don't exist within a user's project (visible work trees). This works by keeping a vector of entry indices that exist within a user's project and updates the list state based on these entries when filtering the list. I went with this approach so the stack frame list wouldn't have to rebuild itself whenever the filter is toggled and it could persist its state across toggles (uncollapsing a collapse list). It was also easier to keep track of selected entries on toggle using the vector as well. ### Preview https://github.com/user-attachments/assets/d86c7485-c885-4bbb-bebb-2f6385674925 Release Notes: - debugger: Add option to only show stack frames from user's project in stack frame list
This commit is contained in:
@@ -85,6 +85,10 @@ actions!(
|
||||
Rerun,
|
||||
/// Toggles expansion of the selected item in the debugger UI.
|
||||
ToggleExpandItem,
|
||||
/// Toggle the user frame filter in the stack frame list
|
||||
/// When toggled on, only frames from the user's code are shown
|
||||
/// When toggled off, all frames are shown
|
||||
ToggleUserFrames,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -272,12 +276,25 @@ pub fn init(cx: &mut App) {
|
||||
}
|
||||
})
|
||||
.on_action({
|
||||
let active_item = active_item.clone();
|
||||
move |_: &ToggleIgnoreBreakpoints, _, cx| {
|
||||
active_item
|
||||
.update(cx, |item, cx| item.toggle_ignore_breakpoints(cx))
|
||||
.ok();
|
||||
}
|
||||
})
|
||||
.on_action(move |_: &ToggleUserFrames, _, cx| {
|
||||
if let Some((thread_status, stack_frame_list)) = active_item
|
||||
.read_with(cx, |item, cx| {
|
||||
(item.thread_status(cx), item.stack_frame_list().clone())
|
||||
})
|
||||
.ok()
|
||||
{
|
||||
stack_frame_list.update(cx, |stack_frame_list, cx| {
|
||||
stack_frame_list.toggle_frame_filter(thread_status, cx);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
.detach();
|
||||
|
||||
Reference in New Issue
Block a user