debugger: Add support for inline value hints (#28656)
This PR uses Tree Sitter to show inline values while a user is in a debug session. We went with Tree Sitter over the LSP Inline Values request because the LSP request isn't widely supported. Tree Sitter is easy for languages/extensions to add support to. Tree Sitter can compute the inline values locally, so there's no need to add extra RPC messages for Collab. Tree Sitter also gives Zed more control over how we want to show variables. There's still more work to be done after this PR, namely differentiating between global/local scoped variables, but it's a great starting point to start iteratively improving it. Release Notes: - N/A --------- Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com> Co-authored-by: Anthony Eid <hello@anthonyeid.me> Co-authored-by: Cole Miller <m@cole-miller.net> Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Kirill <kirill@zed.dev>
This commit is contained in:
parent
d095bab8ad
commit
218496744c
30 changed files with 709 additions and 54 deletions
|
@ -247,7 +247,7 @@ pub fn init(cx: &mut App) {
|
|||
let stack_id = state.selected_stack_frame_id(cx);
|
||||
|
||||
state.session().update(cx, |session, cx| {
|
||||
session.evaluate(text, None, stack_id, None, cx);
|
||||
session.evaluate(text, None, stack_id, None, cx).detach();
|
||||
});
|
||||
});
|
||||
Some(())
|
||||
|
|
|
@ -141,14 +141,16 @@ impl Console {
|
|||
expression
|
||||
});
|
||||
|
||||
self.session.update(cx, |state, cx| {
|
||||
state.evaluate(
|
||||
expression,
|
||||
Some(dap::EvaluateArgumentsContext::Variables),
|
||||
self.stack_frame_list.read(cx).selected_stack_frame_id(),
|
||||
None,
|
||||
cx,
|
||||
);
|
||||
self.session.update(cx, |session, cx| {
|
||||
session
|
||||
.evaluate(
|
||||
expression,
|
||||
Some(dap::EvaluateArgumentsContext::Variables),
|
||||
self.stack_frame_list.read(cx).selected_stack_frame_id(),
|
||||
None,
|
||||
cx,
|
||||
)
|
||||
.detach();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use gpui::{
|
|||
};
|
||||
|
||||
use language::PointUtf16;
|
||||
use project::debugger::breakpoint_store::ActiveStackFrame;
|
||||
use project::debugger::session::{Session, SessionEvent, StackFrame};
|
||||
use project::{ProjectItem, ProjectPath};
|
||||
use ui::{Scrollbar, ScrollbarState, Tooltip, prelude::*};
|
||||
|
@ -265,6 +266,7 @@ impl StackFrameList {
|
|||
return Task::ready(Err(anyhow!("Project path not found")));
|
||||
};
|
||||
|
||||
let stack_frame_id = stack_frame.id;
|
||||
cx.spawn_in(window, async move |this, cx| {
|
||||
let (worktree, relative_path) = this
|
||||
.update(cx, |this, cx| {
|
||||
|
@ -313,12 +315,22 @@ impl StackFrameList {
|
|||
.await?;
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
let Some(thread_id) = this.state.read_with(cx, |state, _| state.thread_id)? else {
|
||||
return Err(anyhow!("No selected thread ID found"));
|
||||
};
|
||||
|
||||
this.workspace.update(cx, |workspace, cx| {
|
||||
let breakpoint_store = workspace.project().read(cx).breakpoint_store();
|
||||
|
||||
breakpoint_store.update(cx, |store, cx| {
|
||||
store.set_active_position(
|
||||
(this.session.read(cx).session_id(), abs_path, position),
|
||||
ActiveStackFrame {
|
||||
session_id: this.session.read(cx).session_id(),
|
||||
thread_id,
|
||||
stack_frame_id,
|
||||
path: abs_path,
|
||||
position,
|
||||
},
|
||||
cx,
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue