Skip to content

Commit 7ad0158

Browse files
notpeterFrGoIs
authored andcommitted
Fix 'Edit in Debug.json' in debugger::Start modal (zed-industries#37002)
Closes zed-industries#36992 Release Notes: - N/A
1 parent 4b75948 commit 7ad0158

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

crates/debugger_ui/src/new_process_modal.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,14 +1383,28 @@ impl PickerDelegate for DebugDelegate {
13831383
.border_color(cx.theme().colors().border_variant)
13841384
.children({
13851385
let action = menu::SecondaryConfirm.boxed_clone();
1386-
KeyBinding::for_action(&*action, window, cx).map(|keybind| {
1387-
Button::new("edit-debug-task", "Edit in debug.json")
1388-
.label_size(LabelSize::Small)
1389-
.key_binding(keybind)
1390-
.on_click(move |_, window, cx| {
1391-
window.dispatch_action(action.boxed_clone(), cx)
1392-
})
1393-
})
1386+
if self.matches.is_empty() {
1387+
Some(
1388+
Button::new("edit-debug-json", "Edit debug.json")
1389+
.label_size(LabelSize::Small)
1390+
.on_click(cx.listener(|_picker, _, window, cx| {
1391+
window.dispatch_action(
1392+
zed_actions::OpenProjectDebugTasks.boxed_clone(),
1393+
cx,
1394+
);
1395+
cx.emit(DismissEvent);
1396+
})),
1397+
)
1398+
} else {
1399+
KeyBinding::for_action(&*action, window, cx).map(|keybind| {
1400+
Button::new("edit-debug-task", "Edit in debug.json")
1401+
.label_size(LabelSize::Small)
1402+
.key_binding(keybind)
1403+
.on_click(move |_, window, cx| {
1404+
window.dispatch_action(action.boxed_clone(), cx)
1405+
})
1406+
})
1407+
}
13941408
})
13951409
.map(|this| {
13961410
if (current_modifiers.alt || self.matches.is_empty()) && !self.prompt.is_empty() {

0 commit comments

Comments
 (0)