Start improving support for keyboard-driven debugging (#29380)

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
Cole Miller 2025-04-25 15:14:47 -04:00 committed by GitHub
parent 7f5c874a38
commit 7623fce4b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 307 additions and 45 deletions

View file

@ -7,7 +7,9 @@ use collections::HashMap;
use dap::OutputEvent;
use editor::{CompletionProvider, Editor, EditorElement, EditorStyle, ExcerptId};
use fuzzy::StringMatchCandidate;
use gpui::{Context, Entity, Render, Subscription, Task, TextStyle, WeakEntity};
use gpui::{
Context, Entity, FocusHandle, Focusable, Render, Subscription, Task, TextStyle, WeakEntity,
};
use language::{Buffer, CodeLabel, ToOffset};
use menu::Confirm;
use project::{
@ -28,6 +30,7 @@ pub struct Console {
stack_frame_list: Entity<StackFrameList>,
last_token: OutputToken,
update_output_task: Task<()>,
focus_handle: FocusHandle,
}
impl Console {
@ -56,6 +59,7 @@ impl Console {
editor.set_show_edit_predictions(Some(false), window, cx);
editor
});
let focus_handle = cx.focus_handle();
let this = cx.weak_entity();
let query_bar = cx.new(|cx| {
@ -82,6 +86,7 @@ impl Console {
stack_frame_list,
update_output_task: Task::ready(()),
last_token: OutputToken(0),
focus_handle,
}
}
@ -230,6 +235,7 @@ impl Render for Console {
});
v_flex()
.track_focus(&self.focus_handle)
.key_context("DebugConsole")
.on_action(cx.listener(Self::evaluate))
.size_full()
@ -242,6 +248,12 @@ impl Render for Console {
}
}
impl Focusable for Console {
fn focus_handle(&self, _cx: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
struct ConsoleQueryBarCompletionProvider(WeakEntity<Console>);
impl CompletionProvider for ConsoleQueryBarCompletionProvider {