debugger: Add stack frame multibuffer (#30395)

This PR adds the ability to expand a debugger stack trace into a multi
buffer and view each frame as it's own excerpt.

Release Notes:

- N/A

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
This commit is contained in:
Anthony Eid 2025-05-13 16:55:05 +02:00 committed by GitHub
parent 6f297132b4
commit 68afe4fdda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 604 additions and 37 deletions

View file

@ -289,6 +289,7 @@ impl InlayId {
}
pub enum ActiveDebugLine {}
pub enum DebugStackFrameLine {}
enum DocumentHighlightRead {}
enum DocumentHighlightWrite {}
enum InputComposition {}
@ -13880,7 +13881,10 @@ impl Editor {
Default::default(),
cx,
);
self.request_autoscroll(Autoscroll::center().for_anchor(start), cx);
if self.buffer.read(cx).is_singleton() {
self.request_autoscroll(Autoscroll::center().for_anchor(start), cx);
}
}
pub fn go_to_definition(
@ -16886,6 +16890,7 @@ impl Editor {
handled = true;
self.clear_row_highlights::<ActiveDebugLine>();
self.go_to_line::<ActiveDebugLine>(
multibuffer_anchor,
Some(cx.theme().colors().editor_debugger_active_line_background),
@ -17900,9 +17905,7 @@ impl Editor {
let Some(project) = self.project.clone() else {
return;
};
let Some(buffer) = self.buffer.read(cx).as_singleton() else {
return;
};
if !self.inline_value_cache.enabled {
let inlays = std::mem::take(&mut self.inline_value_cache.inlays);
self.splice_inlays(&inlays, Vec::new(), cx);
@ -17920,15 +17923,24 @@ impl Editor {
.ok()?;
let inline_values = editor
.update(cx, |_, cx| {
.update(cx, |editor, cx| {
let Some(current_execution_position) = current_execution_position else {
return Some(Task::ready(Ok(Vec::new())));
};
// todo(debugger) when introducing multi buffer inline values check execution position's buffer id to make sure the text
// anchor is in the same buffer
let buffer = editor.buffer.read_with(cx, |buffer, cx| {
let snapshot = buffer.snapshot(cx);
let excerpt = snapshot.excerpt_containing(
current_execution_position..current_execution_position,
)?;
editor.buffer.read(cx).buffer(excerpt.buffer_id())
})?;
let range =
buffer.read(cx).anchor_before(0)..current_execution_position.text_anchor;
project.inline_values(buffer, range, cx)
})
.ok()