debugger: Run locators on LSP tasks for the new process modal (#32097)

- [x] pass LSP tasks into list_debug_scenarios
- [x] load LSP tasks only once for both modals
- [x] align ordering
- [x] improve appearance of LSP debug task icons
- [ ] reconsider how `add_current_language_tasks` works
- [ ] add a test

Release Notes:

- Debugger Beta: Added debuggable LSP tasks to the "Debug" tab of the
new process modal.

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
Cole Miller 2025-06-05 13:25:51 -04:00 committed by GitHub
parent 8730d317a8
commit f36143a461
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 135 additions and 22 deletions

View file

@ -162,15 +162,33 @@ impl TasksModal {
}
}
pub fn task_contexts_loaded(
pub fn tasks_loaded(
&mut self,
task_contexts: Arc<TaskContexts>,
lsp_tasks: Vec<(TaskSourceKind, task::ResolvedTask)>,
used_tasks: Vec<(TaskSourceKind, task::ResolvedTask)>,
current_resolved_tasks: Vec<(TaskSourceKind, task::ResolvedTask)>,
add_current_language_tasks: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
let last_used_candidate_index = if used_tasks.is_empty() {
None
} else {
Some(used_tasks.len() - 1)
};
let mut new_candidates = used_tasks;
new_candidates.extend(lsp_tasks);
// todo(debugger): We're always adding lsp tasks here even if prefer_lsp is false
// We should move the filter to new_candidates instead of on current
// and add a test for this
new_candidates.extend(current_resolved_tasks.into_iter().filter(|(task_kind, _)| {
add_current_language_tasks || !matches!(task_kind, TaskSourceKind::Language { .. })
}));
self.picker.update(cx, |picker, cx| {
picker.delegate.task_contexts = task_contexts;
picker.delegate.candidates = None;
picker.delegate.last_used_candidate_index = last_used_candidate_index;
picker.delegate.candidates = Some(new_candidates);
picker.refresh(window, cx);
cx.notify();
})
@ -296,6 +314,9 @@ impl PickerDelegate for TasksModalDelegate {
.map(move |(_, task)| (kind.clone(), task))
},
));
// todo(debugger): We're always adding lsp tasks here even if prefer_lsp is false
// We should move the filter to new_candidates instead of on current
// and add a test for this
new_candidates.extend(current.into_iter().filter(
|(task_kind, _)| {
add_current_language_tasks