Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(debug): port debug visualizers to the Variables view

rokartur35c9c2c7f045
diff --git a/native/crates/app/src/main_thread.rs b/native/crates/app/src/main_thread.rs
index 01d0030dcc5..9eb49325f08 100644
--- a/native/crates/app/src/main_thread.rs
+++ b/native/crates/app/src/main_thread.rs
@@ -265,8 +265,10 @@ impl WorkbenchMainThread {
/// Workbench calls whose host method ends with a `CancellationToken` (extHost.protocol.ts): rpcProtocol.ts sends
/// them as requests with cancellation, so the host passes a token instead of `undefined`.
-const TOKEN_METHODS: [(&str, &str); 12] = [
+const TOKEN_METHODS: [(&str, &str); 14] = [
("ExtHostDebugService", "$provideDebugConfigurations"),
+ ("ExtHostDebugService", "$provideDebugVisualizers"),
+ ("ExtHostDebugService", "$resolveDebugVisualizer"),
("ExtHostDebugService", "$resolveDebugConfiguration"),
("ExtHostDebugService", "$resolveDebugConfigurationWithSubstitutedVariables"),
("ExtHostTesting", "$runControllerTests"),
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rs
index 4af876b1150..4814f1bc9f8 100644
--- a/native/crates/app/src/workbench.rs
+++ b/native/crates/app/src/workbench.rs
@@ -34,6 +34,7 @@ mod refactor_preview;
mod view_containers;
mod view_visibility;
mod debug_toolbar;
+mod debug_visualizers;
pub(crate) mod debug_service;
pub(crate) mod debug_task_runner;
mod debug_view;
diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rs
index 8d41d818e47..c7370561050 100644
--- a/native/crates/app/src/workbench/debug_service.rs
+++ b/native/crates/app/src/workbench/debug_service.rs
@@ -76,6 +76,7 @@ pub struct DebugService {
/// The scopes of the focused frame, then each expanded row's children by `(session, variablesReference)`.
pub scopes: Vec<Variable>,
pub children: HashMap<(String, i64), Vec<Variable>>,
+ pub visualizers: super::debug_visualizers::DebugVisualizers,
/// Watch expression results by expression id.
pub watch_values: HashMap<String, Variable>,
pub repl: Vec<ReplElement>,
@@ -304,7 +305,7 @@ impl Workbench {
}
self.breakpoints_changed(change, true, cx);
}
- // Visualizers serve the chat-era "visualize" UI of the variables view, which has no desktop caller here.
+ "$registerDebugVisualizer" | "$unregisterDebugVisualizer" | "$registerDebugVisualizerTree" | "$unregisterDebugVisualizerTree" => self.handle_visualizer_request(&request.method, &args),
_ => {}
}
Outcome::done()
@@ -1082,8 +1083,9 @@ impl Workbench {
evaluate_lazy(&this, cx, &session_id, variable).await;
}
}
- let _ = on_workbench(&this, cx, |workbench, _, cx| {
+ let _ = on_workbench(&this, cx, |workbench, window, cx| {
workbench.debug.children.insert(key, variables);
+ workbench.visualize_children(&session_id, reference, window, cx);
cx.notify();
});
})
diff --git a/native/crates/app/src/workbench/debug_view.rs b/native/crates/app/src/workbench/debug_view.rs
index c25c6747e59..661c4e0c422 100644
--- a/native/crates/app/src/workbench/debug_view.rs
+++ b/native/crates/app/src/workbench/debug_view.rs
@@ -35,6 +35,8 @@ pub enum Editing {
Variable { session: String, parent_reference: i64, name: String, watch: bool },
/// A watch expression's value (`setSelectedExpression(expression, settingWatch: true)`).
WatchValue(String),
+ /// A visualized tree item's value (`VisualizedExpression` with `treeItem.canEdit`).
+ Visualized { tree_id: String, item_id: i64 },
NewFunctionBreakpoint,
}
@@ -428,7 +430,7 @@ impl Workbench {
/// A tree row; listWidget.ts `MouseController` moves the list focus to a clicked or right-clicked row and the
/// selection to a clicked one.
- fn debug_row(&self, key: String, depth: usize, twistie: Option<bool>, selected: bool, list_focused: bool, cx: &Context<Self>) -> gpui::Stateful<Div> {
+ pub(super) fn debug_row(&self, key: String, depth: usize, twistie: Option<bool>, selected: bool, list_focused: bool, cx: &Context<Self>) -> gpui::Stateful<Div> {
let is_focus = self.debug_view.focused_row.as_deref() == Some(key.as_str());
let (clicked, right_clicked) = (key.clone(), key.clone());
let row = div()
@@ -541,6 +543,11 @@ impl Workbench {
let Some(children) = self.debug.children.get(&(session.to_owned(), reference)) else { return };
for variable in children {
let key = format!("{parent}/{}", variable.name);
+ let visualizer_row = (session.to_owned(), reference, variable.name.clone());
+ if let Some(visualized) = self.debug.visualizers.visualized.get(&visualizer_row) {
+ self.visualized_rows(&visualized.tree_id, &visualized.item, Some(&visualizer_row), key, depth, list_focused, rows, window, cx);
+ continue;
+ }
let expandable = variable.has_children();
let expanded = expandable && self.row_expanded(&key, false);
let (row_key, session_id, child_reference) = (key.clone(), session.to_owned(), variable.variables_reference);
@@ -550,7 +557,9 @@ impl Workbench {
continue;
}
let lazy_button = variable.is_lazy().then(|| self.lazy_button(session, reference, variable, &key, cx));
- let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).child(self.expression_label(variable, &[], lazy_button).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE)));
+ let group = gpui::SharedString::from(key.clone());
+ let actions = self.visualizer_actions(&visualizer_row, &group, self.debug_view.focused_row.as_deref() == Some(key.as_str()), cx);
+ let mut row = self.debug_row(key.clone(), depth, expandable.then_some(expanded), self.row_selected(&key), list_focused, cx).group(group).child(self.expression_label(variable, &[], lazy_button).font_family(EXPRESSION_FONT).text_size(px(EXPRESSION_FONT_SIZE))).children(actions);
// variablesView.ts `onMouseDblClick`: a variable that `canSetExpressionValue` opens its value's input.
let editable = !in_watch && self.can_set_variable_value(variable);
row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {
@@ -891,6 +900,7 @@ impl Workbench {
Editing::Watch(id) => self.debug.model.watch_expressions.iter().find(|expression| expression.id == *id).map(|expression| expression.name.clone()),
Editing::WatchValue(id) => self.debug.watch_values.get(id).map(|value| value.value.clone()),
Editing::Variable { session, parent_reference, name, .. } => self.debug.children.get(&(session.clone(), *parent_reference)).and_then(|children| children.iter().find(|child| child.name == *name)).map(|variable| variable.value.clone()),
+ Editing::Visualized { tree_id, item_id } => self.visualized_item(tree_id, *item_id).map(|item| item["description"].as_str().unwrap_or_default().to_owned()),
Editing::NewWatch | Editing::NewFunctionBreakpoint => None,
};
if let Some(value) = initial_value {
@@ -905,7 +915,7 @@ impl Workbench {
/// The inline input of the Variables, Watch and Breakpoints views: Enter accepts, Escape cancels, as the trees'
/// `renderInputBox` does; a failed setVariable's message shows under it (inputBox.css `.monaco-inputbox-message`).
- fn debug_input_row(&self, key: String, depth: usize, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> gpui::AnyElement {
+ pub(super) fn debug_input_row(&self, key: String, depth: usize, list_focused: bool, window: &Window, cx: &mut Context<Self>) -> gpui::AnyElement {
let focused = self.debug_view.input_focus.is_focused(window);
let error = self.debug_view.edit_error.as_ref().filter(|_| matches!(self.debug_view.editing, Some(Editing::Variable { .. })));
let border = self.color(if error.is_some() { "inputValidation.errorBorder" } else { "focusBorder" });
@@ -969,6 +979,7 @@ impl Workbench {
let value = self.debug_view.input.value.clone();
return self.set_variable_value(target, value, window, cx);
}
+ Some(Editing::Visualized { tree_id, item_id }) => return self.edit_visualized_item(tree_id, item_id, self.debug_view.input.value.clone(), window, cx),
_ => {}
}
self.store_debug_model();
diff --git a/native/crates/app/src/workbench/debug_visualizers.rs b/native/crates/app/src/workbench/debug_visualizers.rs
new file mode 100644
index 00000000000..01e8fa733ef
--- /dev/null
+++ b/native/crates/app/src/workbench/debug_visualizers.rs
@@ -0,0 +1,619 @@
+//! debugVisualizers.ts `DebugVisualizerService` with mainThreadDebugService.ts's visualizer handlers, debugViewModel.ts's
+//! visualized expressions and variablesView.ts's visualizer actions and `VisualizedVariableRenderer` rows.
+
+use std::collections::{HashMap, HashSet};
+
+use gpui::{ClickEvent, Context, MouseButton, Rgba, Window, div, prelude::*, px};
+use serde_json::{Value, json};
+
+use super::Workbench;
+use super::debug_service::{answer, on_workbench};
+use super::debug_view::{EXPRESSION_FONT, EXPRESSION_FONT_SIZE, Editing};
+use super::hover::{HoverContent, HoverOptions};
+use super::variable_menu::{VariableMenuRow, protocol_variable};
+use crate::commands::Outcome;
+use crate::contextkey::Expr;
+use crate::debug::session::Variable;
+use crate::menus::{MenuAction, MenuId};
+
+/// A variable row: its session, the parent's `variablesReference` and its name.
+pub(super) type RowKey = (String, i64, String);
+
+/// The `debugViz.{index}` commands of the Visualize Variable... menu.
+const PICK_VISUALIZER_ID: &str = "debugViz";
+
+#[derive(Default)]
+pub struct DebugVisualizers {
+ /// `handles`: the `extensionId\0id` keys `$registerDebugVisualizer` registered.
+ handles: HashSet<String>,
+ /// `trees`: the tree ids `$registerDebugVisualizerTree` registered, each with whether its items can be edited.
+ trees: HashMap<String, bool>,
+ /// `getApplicableFor`'s visualizers (`IDebugVisualization`) of each variable row with any.
+ pub applicable: HashMap<RowKey, Vec<Value>>,
+ /// debugViewModel.ts `visualized`: a variable row and the tree it shows as instead.
+ pub visualized: HashMap<RowKey, Visualized>,
+ /// debugViewModel.ts `preferredVisualizers`: `getPreferredVisualizedKey` and the tree id its variables show as.
+ preferred: HashMap<String, String>,
+ /// `getVisualizedChildren` answers by tree id and item id.
+ pub tree_children: HashMap<(String, i64), Vec<Value>>,
+ /// The row and visualizers of the open Visualize Variable... menu.
+ pick: Option<(RowKey, Vec<Value>)>,
+ pick_commands: usize,
+ /// Each row's Visualize Variable... button, the menu's anchor (variablesView.ts `pickVisualizer`).
+ pick_buttons: std::rc::Rc<std::cell::RefCell<HashMap<RowKey, gpui::Bounds<gpui::Pixels>>>>,
+}
+
+/// debugModel.ts `VisualizedExpression` of a variable: the tree and its `IDebugVisualizationTreeItem`.
+#[derive(Clone)]
+pub struct Visualized {
+ pub tree_id: String,
+ pub item: Value,
+}
+
+/// debugViewModel.ts `getPreferredVisualizedKey`.
+fn preferred_key(variable: &Variable) -> String {
+ format!("{}\0{}\0{}", variable.name, variable.type_name.as_deref().unwrap_or_default(), variable.memory_reference.is_some())
+}
+
+/// debugVisualizers.ts `toKey`.
+fn handle_key(extension_id: &str, id: &str) -> String {
+ format!("{}\0{id}", extension_id.to_lowercase())
+}
+
+impl Workbench {
+ /// mainThreadDebugService.ts's visualizer methods.
+ pub(super) fn handle_visualizer_request(&mut self, method: &str, args: &[Value]) {
+ let text = |index: usize| args.get(index).and_then(Value::as_str).unwrap_or_default();
+ let visualizers = &mut self.debug.visualizers;
+ match method {
+ "$registerDebugVisualizer" => _ = visualizers.handles.insert(handle_key(text(0), text(1))),
+ "$unregisterDebugVisualizer" => _ = visualizers.handles.remove(&handle_key(text(0), text(1))),
+ "$registerDebugVisualizerTree" => _ = visualizers.trees.insert(text(0).to_owned(), args.get(1) == Some(&Value::Bool(true))),
+ "$unregisterDebugVisualizerTree" => _ = visualizers.trees.remove(text(0)),
+ _ => {}
+ }
+ }
+
+ /// baseDebugView.ts `AbstractExpressionDataSource.getChildren` and variablesView.ts `renderActionBar` on new
+ /// children: each variable shows as its preferred tree, and asks the visualizers whose `when` holds.
+ pub(super) fn visualize_children(&mut self, session_id: &str, reference: i64, window: &mut Window, cx: &mut Context<Self>) {
+ let parent = (session_id.to_owned(), reference);
+ let visualizers = &mut self.debug.visualizers;
+ let mut disposed = Vec::new();
+ visualizers.applicable.retain(|(session, parent_reference, _), applicable| {
+ let stale = (session.as_str(), *parent_reference) == (session_id, reference);
+ if stale {
+ disposed.extend(applicable.iter().map(|visualizer| visualizer["id"].clone()));
+ }
+ !stale
+ });
+ visualizers.visualized.retain(|(session, parent_reference, _), _| (session.as_str(), *parent_reference) != (session_id, reference));
+ if !disposed.is_empty() {
+ self.host.send("ExtHostDebugService", "$disposeDebugVisualizers", vec![Value::Array(disposed)]);
+ }
+ let Some(thread) = self.debug.focus.thread else { return };
+ let registrations = self.visualizer_registrations();
+ let children = self.debug.children.get(&parent).cloned().unwrap_or_default();
+ for variable in children {
+ let row: RowKey = (session_id.to_owned(), reference, variable.name.clone());
+ let context = self.visualization_context(session_id, reference, thread, &variable);
+ if let Some(tree_id) = self.debug.visualizers.preferred.get(&preferred_key(&variable)).cloned() {
+ self.show_visualized(row.clone(), tree_id, context.clone(), window, cx);
+ }
+ if registrations.is_empty() {
+ continue;
+ }
+ let when_context = self.visualizer_when_context(&row, &variable, window);
+ let matching: Vec<(String, String)> = registrations.iter().filter(|(_, _, when)| when.evaluate(&when_context)).map(|(extension, id, _)| (extension.clone(), id.clone())).collect();
+ if !matching.is_empty() {
+ self.provide_visualizers(row, matching, context, window, cx);
+ }
+ }
+ }
+
+ /// `processExtensionRegistration`: every extension's `debugVisualizers` whose `when` parses.
+ fn visualizer_registrations(&self) -> Vec<(String, String, Expr)> {
+ let mut registrations = Vec::new();
+ for extension in &self.extensions {
+ for visualizer in extension.description["contributes"]["debugVisualizers"].as_array().into_iter().flatten() {
+ let (Some(id), Some(when)) = (visualizer["id"].as_str(), visualizer["when"].as_str().and_then(Expr::deserialize)) else { continue };
+ registrations.push((extension.id.to_lowercase(), id.to_owned(), when));
+ }
+ }
+ registrations
+ }
+
+ /// debugContext.ts `getContextForVariable` with the variable's name, value and type.
+ fn visualizer_when_context(&self, row: &RowKey, variable: &Variable, window: &Window) -> HashMap<String, Value> {
+ let mut context = self.key_context(window);
+ let menu_row = VariableMenuRow::Variable { menu: MenuId::DebugVariablesContext, session: row.0.clone(), parent_reference: row.1, variable: variable.clone() };
+ self.variable_menu_context(&menu_row, &mut context);
+ context.insert("variableName".into(), json!(variable.name));
+ context.insert("variableValue".into(), json!(variable.value));
+ context.insert("variableType".into(), json!(variable.type_name));
+ context
+ }
+
+ /// `getVariableContext`: `containerId` under a variable, `frameId` of the scope the variable descends from.
+ fn visualization_context(&self, session_id: &str, reference: i64, thread: i64, variable: &Variable) -> Value {
+ let parent_of = |reference: i64| self.debug.children.iter().find(|((session, _), children)| session == session_id && children.iter().any(|child| child.variables_reference == reference)).map(|((_, parent), _)| *parent);
+ let mut context = json!({ "sessionId": session_id, "threadId": thread, "variable": protocol_variable(variable) });
+ if parent_of(reference).is_some() {
+ context["containerId"] = json!(variable.variables_reference);
+ }
+ let mut ancestor = reference;
+ let mut visited = HashSet::new();
+ while visited.insert(ancestor) {
+ if self.debug.scopes.iter().any(|scope| scope.variables_reference == ancestor) {
+ context["frameId"] = json!(self.debug.focus.frame);
+ break;
+ }
+ let Some(parent) = parent_of(ancestor) else { break };
+ ancestor = parent;
+ }
+ context
+ }
+
+ /// `getApplicableFor`: each matching visualizer's extension activated by `onDebugVisualizer:{id}`, then asked.
+ fn provide_visualizers(&mut self, row: RowKey, matching: Vec<(String, String)>, context: Value, window: &mut Window, cx: &mut Context<Self>) {
+ let activations: Vec<_> = matching.iter().map(|(_, id)| self.host.activate_by_event(&format!("onDebugVisualizer:{id}"))).collect();
+ cx.spawn_in(window, async move |this, cx| {
+ let mut found = Vec::new();
+ for ((extension, id), activation) in matching.into_iter().zip(activations) {
+ let _ = activation.await;
+ let Ok(Some(reply)) = on_workbench(&this, cx, |workbench, _, _| {
+ workbench.debug.visualizers.handles.contains(&handle_key(&extension, &id)).then(|| workbench.host.call("ExtHostDebugService", "$provideDebugVisualizers", vec![json!(extension), json!(id), context.clone()]))
+ }) else { continue };
+ found.extend(answer(reply).await.ok().and_then(|visualizers| visualizers.as_array().cloned()).unwrap_or_default());
+ }
+ if found.is_empty() {
+ return;
+ }
+ let _ = on_workbench(&this, cx, |workbench, _, cx| {
+ let shown = workbench.debug.children.get(&(row.0.clone(), row.1)).is_some_and(|children| children.iter().any(|child| child.name == row.2));
+ if !shown {
+ let ids = found.iter().map(|visualizer| visualizer["id"].clone()).collect();
+ return workbench.host.send("ExtHostDebugService", "$disposeDebugVisualizers", vec![Value::Array(ids)]);
+ }
+ workbench.debug.visualizers.applicable.insert(row, found);
+ cx.notify();
+ });
+ })
+ .detach();
+ }
+
+ /// `getVisualizedNodeFor` then `setVisualizedExpression`: the row shows as the tree's item for the variable.
+ fn show_visualized(&mut self, row: RowKey, tree_id: String, context: Value, window: &mut Window, cx: &mut Context<Self>) {
+ if !self.debug.visualizers.trees.contains_key(&tree_id) {
+ return;
+ }
+ let reply = self.host.call("ExtHostDebugService", "$getVisualizerTreeItem", vec![json!(tree_id), context]);
+ cx.spawn_in(window, async move |this, cx| {
+ let item = match answer(reply).await {
+ Ok(item) if item.is_object() => item,
+ Ok(_) => return,
+ Err(error) => return eprintln!("Failed to get visualized node {error}"),
+ };
+ let _ = on_workbench(&this, cx, |workbench, _, cx| {
+ let Some(variable) = workbench.debug.children.get(&(row.0.clone(), row.1)).and_then(|children| children.iter().find(|child| child.name == row.2)) else { return };
+ workbench.debug.visualizers.preferred.insert(preferred_key(variable), tree_id.clone());
+ workbench.debug.visualizers.visualized.insert(row, Visualized { tree_id, item });
+ cx.notify();
+ });
+ })
+ .detach();
+ }
+
+ /// variablesView.ts `useVisualizer`: a command visualizer runs, a tree visualizer replaces the row.
+ fn use_visualizer(&mut self, row: RowKey, visualizer: Value, window: &mut Window, cx: &mut Context<Self>) {
+ let id = visualizer["id"].clone();
+ let resolve = visualizer["visualization"].is_null().then(|| self.host.call("ExtHostDebugService", "$resolveDebugVisualizer", vec![id.clone()]));
+ cx.spawn_in(window, async move |this, cx| {
+ let visualization = match resolve {
+ Some(reply) => answer(reply).await.unwrap_or_default(),
+ None => visualizer["visualization"].clone(),
+ };
+ let _ = on_workbench(&this, cx, |workbench, window, cx| {
+ // DebugVisualizationType.Command
+ if visualization["type"] == 0 {
+ return workbench.host.send("ExtHostDebugService", "$executeDebugVisualizerCommand", vec![id]);
+ }
+ let Some(tree_id) = visualization["id"].as_str() else { return };
+ let (Some(thread), Some(variable)) = (workbench.debug.focus.thread, workbench.debug.children.get(&(row.0.clone(), row.1)).and_then(|children| children.iter().find(|child| child.name == row.2)).cloned()) else { return };
+ let context = workbench.visualization_context(&row.0, row.1, thread, &variable);
+ workbench.show_visualized(row, tree_id.to_owned(), context, window, cx);
+ });
+ })
+ .detach();
+ }
+
+ /// The Remove Visualizer action: `setVisualizedExpression(original, undefined)`.
+ fn remove_visualizer(&mut self, row: &RowKey, cx: &mut Context<Self>) {
+ self.debug.visualizers.visualized.remove(row);
+ if let Some(variable) = self.debug.children.get(&(row.0.clone(), row.1)).and_then(|children| children.iter().find(|child| child.name == row.2)) {
+ self.debug.visualizers.preferred.remove(&preferred_key(variable));
+ }
+ cx.notify();
+ }
+
+ /// `pickVisualizer`: the menu of the row's visualizers under its action bar.
+ fn pick_visualizer(&mut self, row: RowKey, visualizers: Vec<Value>, anchor: gpui::Bounds<gpui::Pixels>, window: &mut Window, cx: &mut Context<Self>) {
+ while self.debug.visualizers.pick_commands < visualizers.len() {
+ let index = self.debug.visualizers.pick_commands;
+ self.commands.register(format!("{PICK_VISUALIZER_ID}.{index}"), move |workbench, _, window, cx| {
+ let Some((row, visualizers)) = workbench.debug.visualizers.pick.take() else { return Outcome::done() };
+ if let Some(visualizer) = visualizers.get(index).cloned() {
+ workbench.use_visualizer(row, visualizer, window, cx);
+ }
+ Outcome::done()
+ });
+ self.debug.visualizers.pick_commands += 1;
+ }
+ let actions = visualizers.iter().enumerate().map(|(index, visualizer)| MenuAction::Command { id: format!("{PICK_VISUALIZER_ID}.{index}"), title: visualizer["name"].as_str().unwrap_or_default().to_owned(), enabled: true, checked: false, alt: None }).collect();
+ self.debug.visualizers.pick = Some((row, visualizers));
+ let context = self.key_context(window);
+ self.show_context_menu_actions(actions, &context, anchor, Vec::new(), window, cx);
+ }
+
+ /// The visualizer actions at the end of a variable row: one visualizer's own icon, several behind
+ /// Visualize Variable...; shown on the hovered or focused row (debugViewlet.css).
+ pub(super) fn visualizer_actions(&self, row: &RowKey, group: &gpui::SharedString, focused: bool, cx: &mut Context<Self>) -> Option<gpui::AnyElement> {
+ let visualizers = self.debug.visualizers.applicable.get(row)?.clone();
+ let foreground = self.foreground_or("icon.foreground");
+ let id = format!("{}/{}/{}/viz", row.0, row.1, row.2);
+ let button = match visualizers.as_slice() {
+ [visualizer] => {
+ let (row, visualizer) = (row.clone(), visualizer.clone());
+ let title = visualizer["name"].as_str().unwrap_or_default().to_owned();
+ self.visualizer_button(&id, visualizer_icon(&visualizer), title, foreground).on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
+ cx.stop_propagation();
+ workbench.use_visualizer(row.clone(), visualizer.clone(), window, cx);
+ }))
+ }
+ _ => {
+ let (row, tracked_row, tracked) = (row.clone(), row.clone(), self.debug.visualizers.pick_buttons.clone());
+ self.visualizer_button(&id, Some("eye".into()), "Visualize Variable...".into(), foreground)
+ .debug_selector(|| "visualize-variable".into())
+ .child(gpui::canvas(move |bounds, _, _| _ = tracked.borrow_mut().insert(tracked_row, bounds), |_, _, _, _| {}).absolute().size_full())
+ .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
+ cx.stop_propagation();
+ let anchor = workbench.debug.visualizers.pick_buttons.borrow()[&row];
+ workbench.pick_visualizer(row.clone(), visualizers.clone(), anchor, window, cx);
+ }))
+ }
+ };
+ Some(self.row_action_bar(group, focused).child(button).into_any_element())
+ }
+
+ fn visualizer_button(&self, id: &str, icon: Option<String>, title: String, foreground: Rgba) -> gpui::Stateful<gpui::Div> {
+ let label = match icon {
+ Some(icon) => self.icon(&icon, 20., 16., foreground),
+ None => div().size(px(20.)),
+ };
+ label
+ .id(gpui::SharedString::from(id.to_owned()))
+ .rounded(px(5.))
+ .cursor_pointer()
+ .hover(|button| button.bg(self.color("toolbar.hoverBackground")))
+ .on_mouse_down(MouseButton::Left, super::scm_view::stop_action_mouse_down)
+ .child(self.hover_target(gpui::SharedString::from(format!("{id}/hover")), HoverContent::Text(title), HoverOptions::action_item()))
+ }
+
+ fn row_action_bar(&self, group: &gpui::SharedString, focused: bool) -> gpui::Div {
+ div().flex_none().ml_auto().flex().items_center().invisible().when(focused, |bar| bar.visible()).group_hover(group.clone(), |bar| bar.visible())
+ }
+
+ /// `VisualizedVariableRenderer`: a visualized row, then its expanded children. `original` is the variable row it
+ /// replaces, which shows Remove Visualizer.
+ #[allow(clippy::too_many_arguments)]
+ pub(super) fn visualized_rows(&self, tree_id: &str, item: &Value, original: Option<&RowKey>, key: String, depth: usize, list_focused: bool, rows: &mut Vec<gpui::AnyElement>, window: &Window, cx: &mut Context<Self>) {
+ let item_id = item["id"].as_i64().unwrap_or_default();
+ let edit = Editing::Visualized { tree_id: tree_id.to_owned(), item_id };
+ if self.debug_view.editing.as_ref() == Some(&edit) {
+ rows.push(self.debug_input_row(key, depth, list_focused, window, cx));
+ return;
+ }
+ // DebugTreeItemCollapsibleState.None
+ let expandable = item["collapsibleState"].as_u64().unwrap_or_default() != 0;
+ let expanded = expandable && self.row_expanded(&key, false);
+ let label = item["label"].as_str().unwrap_or_default();
+ let description = item["description"].as_str().unwrap_or_default();
+ let text = match description.is_empty() {
+ true => label.to_owned(),
+ false => format!("{label}:"),
+ };
+ let value_color = self.value_color(&Variable { value: description.to_owned(), ..Variable::default() });
+ let group = gpui::SharedString::from(key.clone());
+ let focused = self.debug_view.focused_row.as_deref() == Some(key.as_str());
+ let mut row = self
+ .debug_row(key.clone(), depth, expandable.then_some(expanded), self.debug_view.selected.as_deref() == Some(key.as_str()), list_focused, cx)
+ .group(group.clone())
+ .child(
+ div()
+ .flex()
+ .min_w_0()
+ .overflow_hidden()
+ .whitespace_nowrap()
+ .font_family(EXPRESSION_FONT)
+ .text_size(px(EXPRESSION_FONT_SIZE))
+ .child(div().text_color(self.color("debugTokenExpression.name")).child(text))
+ .child(div().ml(px(6.)).text_color(value_color).overflow_hidden().text_ellipsis().child(description.to_owned())),
+ );
+ if let Some(original) = original.cloned() {
+ let foreground = self.foreground_or("icon.foreground");
+ let button = self.visualizer_button(&format!("{key}/remove-viz"), Some("eye".into()), "Remove Visualizer".into(), foreground).on_click(cx.listener(move |workbench, _: &ClickEvent, _, cx| {
+ cx.stop_propagation();
+ workbench.remove_visualizer(&original, cx);
+ }));
+ row = row.child(self.row_action_bar(&group, focused).child(button));
+ }
+ let can_edit = item["canEdit"] == true;
+ let (row_key, tree) = (key.clone(), tree_id.to_owned());
+ row = row.on_click(cx.listener(move |workbench, event: &ClickEvent, window, cx| {
+ // variablesView.ts `canSetExpressionValue`: a visualized item that `canEdit`.
+ if can_edit && event.click_count() == 2 {
+ return workbench.start_debug_view_edit(edit.clone(), window, cx);
+ }
+ if expandable {
+ workbench.toggle_visualized_row(&row_key, expanded, &tree, item_id, window, cx);
+ }
+ }));
+ rows.push(row.into_any_element());
+ if !expanded {
+ return;
+ }
+ let children = self.debug.visualizers.tree_children.get(&(tree_id.to_owned(), item_id)).cloned().unwrap_or_default();
+ for child in &children {
+ let child_key = format!("{key}/{}", child["id"].as_i64().unwrap_or_default());
+ self.visualized_rows(tree_id, child, None, child_key, depth + 1, list_focused, rows, window, cx);
+ }
+ }
+
+ /// `VisualizedExpression.getChildren`: `$getVisualizerTreeItemChildren` the first time the row expands.
+ fn toggle_visualized_row(&mut self, key: &str, expanded: bool, tree_id: &str, item_id: i64, window: &mut Window, cx: &mut Context<Self>) {
+ if expanded {
+ self.debug_view.expanded.remove(key);
+ self.debug_view.collapsed_rows.insert(key.to_owned());
+ } else {
+ self.debug_view.collapsed_rows.remove(key);
+ self.debug_view.expanded.insert(key.to_owned());
+ self.fetch_visualized_children(tree_id, item_id, window, cx);
+ }
+ self.debug_view.selected = Some(key.to_owned());
+ cx.notify();
+ }
+
+ fn fetch_visualized_children(&mut self, tree_id: &str, item_id: i64, window: &mut Window, cx: &mut Context<Self>) {
+ if !self.debug.visualizers.trees.contains_key(tree_id) {
+ return;
+ }
+ let key = (tree_id.to_owned(), item_id);
+ let reply = self.host.call("ExtHostDebugService", "$getVisualizerTreeItemChildren", vec![json!(tree_id), json!(item_id)]);
+ cx.spawn_in(window, async move |this, cx| {
+ let children = answer(reply).await.ok().and_then(|children| children.as_array().cloned()).unwrap_or_default();
+ let _ = on_workbench(&this, cx, |workbench, _, cx| {
+ workbench.debug.visualizers.tree_children.insert(key, children);
+ cx.notify();
+ });
+ })
+ .detach();
+ }
+
+ /// The visualized item's value in its input: `VisualizedExpression.value`.
+ pub(super) fn visualized_item(&self, tree_id: &str, item_id: i64) -> Option<&Value> {
+ let visualizers = &self.debug.visualizers;
+ let roots = visualizers.visualized.values().filter(|visualized| visualized.tree_id == tree_id).map(|visualized| &visualized.item);
+ let children = visualizers.tree_children.iter().filter(|((tree, _), _)| tree == tree_id).flat_map(|(_, children)| children);
+ roots.chain(children).find(|item| item["id"] == item_id)
+ }
+
+ /// `VisualizedVariableRenderer.getInputBoxOptions` `onFinish`: `editTreeItem`, whose answer replaces the item in
+ /// place, then `updateViews`. A failed edit sets `errorMessage` after the input closed, so nothing shows it.
+ pub(super) fn edit_visualized_item(&mut self, tree_id: String, item_id: i64, value: String, window: &mut Window, cx: &mut Context<Self>) {
+ if self.debug.visualizers.trees.get(&tree_id) != Some(&true) {
+ return;
+ }
+ let reply = self.host.call("ExtHostDebugService", "$editVisualizerTreeItem", vec![json!(item_id), json!(value)]);
+ cx.spawn_in(window, async move |this, cx| {
+ let Ok(new_item) = answer(reply).await else { return };
+ let _ = on_workbench(&this, cx, |workbench, window, cx| {
+ if let Some(fields) = new_item.as_object() {
+ let visualizers = &mut workbench.debug.visualizers;
+ let roots = visualizers.visualized.values_mut().filter(|visualized| visualized.tree_id == tree_id).map(|visualized| &mut visualized.item);
+ let children = visualizers.tree_children.iter_mut().filter(|((tree, _), _)| *tree == tree_id).flat_map(|(_, children)| children.iter_mut());
+ for item in roots.chain(children).filter(|item| item["id"] == item_id) {
+ for (field, value) in fields {
+ item[field] = value.clone();
+ }
+ }
+ }
+ workbench.update_debug_views(window, cx);
+ });
+ })
+ .detach();
+ }
+}
+
+/// `v.iconClass`, `ThemeIcon.asClassName`'s `codicon codicon-{id}`; without one the action has no icon.
+fn visualizer_icon(visualizer: &Value) -> Option<String> {
+ let class = visualizer["iconClass"].as_str()?;
+ class.split(' ').find_map(|part| part.strip_prefix("codicon-")).map(str::to_owned)
+}
+
+#[cfg(test)]
+mod tests {
+ use std::sync::mpsc::Receiver;
+
+ use exthost::session::ForwardedRequest;
+ use gpui::{TestAppContext, VisualTestContext};
+ use serde_json::{Value, json};
+
+ use super::super::debug_view::Editing;
+ use super::super::variable_menu::tests::{respond, sent_request, stopped_session};
+ use super::*;
+ use crate::host_sync::HostMessage;
+
+ const TREE: &str = "port.viz\0tree";
+
+ /// A stopped session whose Local scope (reference 4) shows `x` and `y`, with an extension contributing visualizer
+ /// `v` for `variableName == 'x'` and registering it and its editable tree.
+ fn visualizer_session(cx: &mut TestAppContext) -> (gpui::Entity<Workbench>, &mut VisualTestContext, Receiver<HostMessage>) {
+ let (workbench, cx, host) = stopped_session(cx, json!({}));
+ workbench.update_in(cx, |workbench, window, cx| {
+ let description = json!({ "contributes": { "debugVisualizers": [{ "id": "v", "when": "variableName == 'x'" }] } });
+ workbench.extensions.push(exthost::scan::ScannedExtension { id: "port.viz".into(), location: "/viz".into(), description });
+ workbench.debug.scopes = vec![Variable { name: "Local".into(), variables_reference: 4, ..Variable::default() }];
+ for (method, args) in [("$registerDebugVisualizer", vec![json!("port.viz"), json!("v")]), ("$registerDebugVisualizerTree", vec![json!(TREE), json!(true)])] {
+ let request = ForwardedRequest { req: 1, proxy: "MainThreadDebugService", method: method.into(), args };
+ drop(workbench.handle_debug_request(request, window, cx));
+ }
+ });
+ cx.run_until_parked();
+ host.try_iter().for_each(drop);
+ workbench.update_in(cx, |workbench, window, cx| workbench.fetch_children("s", 4, window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "variables");
+ respond(&workbench, cx, &request, true, json!({ "variables": [{ "name": "x", "value": "1", "variablesReference": 0 }, { "name": "y", "value": "2", "variablesReference": 0 }] }));
+ (workbench, cx, host)
+ }
+
+ /// The host calls since the last one, each answered by `answer`.
+ fn answer_calls(host: &Receiver<HostMessage>, cx: &mut VisualTestContext, answer: impl Fn(&str, &[Value]) -> Value) -> Vec<(&'static str, Vec<Value>)> {
+ let mut calls = Vec::new();
+ loop {
+ cx.run_until_parked();
+ let messages: Vec<HostMessage> = host.try_iter().collect();
+ if messages.is_empty() {
+ return calls;
+ }
+ for message in messages {
+ if let Some(reply) = message.reply {
+ let _ = reply.send(Ok(answer(message.method, &message.args)));
+ }
+ calls.push((message.method, message.args));
+ }
+ }
+ }
+
+ fn methods(calls: &[(&'static str, Vec<Value>)]) -> Vec<&'static str> {
+ calls.iter().map(|(method, _)| *method).collect()
+ }
+
+ fn tree_visualizer() -> Value {
+ json!({ "id": 1, "name": "Tree", "iconClass": "codicon codicon-graph", "visualization": { "type": 1, "id": TREE } })
+ }
+
+ fn tree_answer(method: &str, _: &[Value]) -> Value {
+ match method {
+ "$provideDebugVisualizers" => json!([tree_visualizer()]),
+ "$getVisualizerTreeItem" => json!({ "id": 7, "label": "x", "description": "tree", "collapsibleState": 1, "canEdit": true }),
+ "$getVisualizerTreeItemChildren" => json!([{ "id": 8, "label": "child", "collapsibleState": 0 }]),
+ "$editVisualizerTreeItem" => json!({ "id": 7, "label": "x", "description": "edited", "collapsibleState": 1, "canEdit": true }),
+ _ => Value::Null,
+ }
+ }
+
+ /// debugVisualizers.ts `getApplicableFor`: only a variable whose `when` holds activates `onDebugVisualizer:v`
+ /// and asks `$provideDebugVisualizers` with `getVariableContext`.
+ #[gpui::test]
+ fn a_visualizer_whose_when_holds_is_asked_for_its_variable(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = visualizer_session(cx);
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert_eq!(methods(&calls), ["$activateByEvent", "$provideDebugVisualizers"]);
+ assert_eq!(calls[0].1[0], "onDebugVisualizer:v");
+ let context = &calls[1].1[2];
+ assert_eq!((&calls[1].1[0], &calls[1].1[1]), (&json!("port.viz"), &json!("v")));
+ assert_eq!((&context["sessionId"], &context["threadId"], &context["frameId"], &context["variable"]["name"]), (&json!("s"), &json!(1), &json!(9), &json!("x")));
+ assert!(context.get("containerId").is_none(), "a variable under a scope has no container");
+ let applicable = workbench.read_with(cx, |workbench, _| workbench.debug.visualizers.applicable.clone());
+ assert_eq!(applicable, HashMap::from([(("s".to_owned(), 4, "x".to_owned()), vec![tree_visualizer()])]));
+ assert_eq!(visualizer_icon(&tree_visualizer()).as_deref(), Some("graph"));
+ }
+
+ /// variablesView.ts `useVisualizer` on a tree: the row shows the tree's item, its children come from
+ /// `$getVisualizerTreeItemChildren`, the next children of the scope show it again (`preferredVisualizers`), and
+ /// Remove Visualizer brings the variable back.
+ #[gpui::test]
+ fn a_tree_visualizer_replaces_the_row_until_removed(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = visualizer_session(cx);
+ answer_calls(&host, cx, tree_answer);
+ let row: RowKey = ("s".into(), 4, "x".into());
+ workbench.update_in(cx, |workbench, window, cx| workbench.use_visualizer(row.clone(), tree_visualizer(), window, cx));
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert_eq!(methods(&calls), ["$getVisualizerTreeItem"]);
+ assert_eq!((&calls[0].1[0], &calls[0].1[1]["variable"]["name"]), (&json!(TREE), &json!("x")));
+ let shown = |cx: &mut VisualTestContext| workbench.read_with(cx, |workbench, _| workbench.debug.visualizers.visualized.get(&row).map(|visualized| visualized.item["description"].clone()));
+ assert_eq!(shown(cx), Some(json!("tree")));
+
+ workbench.update_in(cx, |workbench, window, cx| workbench.toggle_visualized_row("viz", false, TREE, 7, window, cx));
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert_eq!(calls.iter().find(|(method, _)| *method == "$getVisualizerTreeItemChildren").map(|(_, args)| args.clone()), Some(vec![json!(TREE), json!(7)]));
+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.debug.visualizers.tree_children[&(TREE.to_owned(), 7)][0]["label"].clone()), "child");
+
+ workbench.update_in(cx, |workbench, window, cx| workbench.update_debug_views(window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "variables");
+ respond(&workbench, cx, &request, true, json!({ "variables": [{ "name": "x", "value": "3", "variablesReference": 0 }] }));
+ assert_eq!(shown(cx), None, "new children drop the old visualized rows");
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert!(methods(&calls).contains(&"$getVisualizerTreeItem"), "the preferred tree visualizes the new x: {:?}", methods(&calls));
+ assert_eq!(shown(cx), Some(json!("tree")));
+
+ workbench.update_in(cx, |workbench, _, cx| workbench.remove_visualizer(&row, cx));
+ assert_eq!(shown(cx), None);
+ workbench.update_in(cx, |workbench, window, cx| workbench.update_debug_views(window, cx));
+ cx.run_until_parked();
+ let request = sent_request(&host, "variables");
+ respond(&workbench, cx, &request, true, json!({ "variables": [{ "name": "x", "value": "4", "variablesReference": 0 }] }));
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert!(!methods(&calls).contains(&"$getVisualizerTreeItem"), "a removed visualizer is no longer preferred");
+ }
+
+ /// `VisualizedVariableRenderer.getInputBoxOptions`: an item that `canEdit` opens with its description, and the
+ /// accepted value goes to `$editVisualizerTreeItem`, whose answer replaces the item.
+ #[gpui::test]
+ fn an_editable_visualized_item_takes_a_new_value(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = visualizer_session(cx);
+ answer_calls(&host, cx, tree_answer);
+ workbench.update_in(cx, |workbench, window, cx| workbench.use_visualizer(("s".into(), 4, "x".into()), tree_visualizer(), window, cx));
+ answer_calls(&host, cx, tree_answer);
+ let edit = Editing::Visualized { tree_id: TREE.into(), item_id: 7 };
+ workbench.update_in(cx, |workbench, window, cx| workbench.start_debug_view_edit(edit.clone(), window, cx));
+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.debug_view.input.value.clone()), "tree");
+ workbench.update_in(cx, |workbench, window, cx| workbench.edit_visualized_item(TREE.into(), 7, "edited".into(), window, cx));
+ let calls = answer_calls(&host, cx, tree_answer);
+ assert_eq!(calls.iter().find(|(method, _)| *method == "$editVisualizerTreeItem").map(|(_, args)| args.clone()), Some(vec![json!(7), json!("edited")]));
+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.visualized_item(TREE, 7).map(|item| item["description"].clone())), Some(json!("edited")));
+ }
+
+ /// variablesView.ts `pickVisualizer`: the Visualize Variable... menu hangs below its button, `getAnchor` the
+ /// action bar, not at the click.
+ #[gpui::test]
+ fn the_visualize_variable_menu_opens_below_its_button(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = visualizer_session(cx);
+ answer_calls(&host, cx, |method, args| if method == "$provideDebugVisualizers" { json!([tree_visualizer(), { "id": 2, "name": "Other" }]) } else { tree_answer(method, args) });
+ workbench.update_in(cx, |workbench, _, cx| {
+ workbench.show_debug_view(cx);
+ workbench.debug_view.expanded.insert("scope/Local".into());
+ workbench.debug_view.focused_row = Some("scope/Local/x".into());
+ cx.notify();
+ });
+ cx.run_until_parked();
+ let button = cx.debug_bounds("visualize-variable").expect("x has two visualizers behind Visualize Variable...");
+ cx.simulate_click(button.origin + gpui::point(gpui::px(2.), gpui::px(2.)), gpui::Modifiers::none());
+ let origin = workbench.read_with(cx, |workbench, _| workbench.context_menu.as_ref().expect("the menu opens").levels[0].origin);
+ assert_eq!((origin.x, origin.y), (button.left(), button.bottom()));
+ }
+
+ /// `useVisualizer` on a visualizer without a visualization: `$resolveDebugVisualizer`, and a command one runs
+ /// through `$executeDebugVisualizerCommand`.
+ #[gpui::test]
+ fn a_command_visualizer_resolves_and_runs(cx: &mut TestAppContext) {
+ let (workbench, cx, host) = visualizer_session(cx);
+ answer_calls(&host, cx, tree_answer);
+ workbench.update_in(cx, |workbench, window, cx| workbench.use_visualizer(("s".into(), 4, "x".into()), json!({ "id": 3, "name": "Run" }), window, cx));
+ let calls = answer_calls(&host, cx, |method, _| if method == "$resolveDebugVisualizer" { json!({ "type": 0 }) } else { Value::Null });
+ assert_eq!(calls, [("$resolveDebugVisualizer", vec![json!(3)]), ("$executeDebugVisualizerCommand", vec![json!(3)])]);
+ assert!(workbench.read_with(cx, |workbench, _| workbench.debug.visualizers.visualized.is_empty()));
+ }
+}
diff --git a/native/crates/app/src/workbench/variable_menu.rs b/native/crates/app/src/workbench/variable_menu.rs
index fd082434a6b..78fc37eee6a 100644
--- a/native/crates/app/src/workbench/variable_menu.rs
+++ b/native/crates/app/src/workbench/variable_menu.rs
@@ -308,7 +308,7 @@ impl Workbench {
}
/// debugModel.ts `Variable.toDebugProtocolObject`.
-fn protocol_variable(variable: &Variable) -> Value {
+pub(super) fn protocol_variable(variable: &Variable) -> Value {
json!({
"name": variable.name,
"value": variable.value,
@@ -361,7 +361,7 @@ fn evaluate_name_or_value(variable: &Value) -> Value {
}
#[cfg(test)]
-mod tests {
+pub(super) mod tests {
use std::path::Path;
use exthost::session::ForwardedRequest;
@@ -495,7 +495,7 @@ mod tests {
assert_eq!(added, [("d1".to_owned(), "write".to_owned(), "x".to_owned())]);
}
- fn stopped_session(cx: &mut TestAppContext, capabilities: Value) -> (gpui::Entity<Workbench>, &mut gpui::VisualTestContext, std::sync::mpsc::Receiver<HostMessage>) {
+ pub(in crate::workbench) fn stopped_session(cx: &mut TestAppContext, capabilities: Value) -> (gpui::Entity<Workbench>, &mut gpui::VisualTestContext, std::sync::mpsc::Receiver<HostMessage>) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();
@@ -522,11 +522,11 @@ mod tests {
})
}
- fn sent_request(host: &std::sync::mpsc::Receiver<HostMessage>, command: &str) -> Value {
+ pub(in crate::workbench) fn sent_request(host: &std::sync::mpsc::Receiver<HostMessage>, command: &str) -> Value {
host.try_iter().filter(|message| message.method == "$sendDAMessage").map(|message| message.args[1].clone()).find(|request| request["command"] == command).unwrap_or_else(|| panic!("a {command} request"))
}
- fn respond(workbench: &gpui::Entity<Workbench>, cx: &mut gpui::VisualTestContext, request: &Value, success: bool, body: Value) {
+ pub(in crate::workbench) fn respond(workbench: &gpui::Entity<Workbench>, cx: &mut gpui::VisualTestContext, request: &Value, success: bool, body: Value) {
let response = json!({ "type": "response", "seq": 0, "request_seq": request["seq"], "success": success, "command": request["command"], "message": body["error"]["format"], "body": body });
let accept = ForwardedRequest { req: 1, proxy: "MainThreadDebugService", method: "$acceptDAMessage".into(), args: vec![json!(1), response] };
workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_debug_request(accept, window, cx)));
diff --git a/port/fixtures/extensions/debug-visualizer-pair/extension.js b/port/fixtures/extensions/debug-visualizer-pair/extension.js
new file mode 100644
index 00000000000..4053cb60fc8
--- /dev/null
+++ b/port/fixtures/extensions/debug-visualizer-pair/extension.js
@@ -0,0 +1,22 @@
+const vscode = require('vscode');
+
+exports.activate = context => {
+ context.subscriptions.push(vscode.debug.registerDebugVisualizationTreeProvider('port.tree', {
+ getTreeItem: ({ variable }) => ({ label: variable.name, description: variable.value, collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, canEdit: true }),
+ getChildren: () => ['first', 'second'].map(label => ({ label, description: `${label} value`, collapsibleState: vscode.TreeItemCollapsibleState.None })),
+ editItem: (item, value) => ({ ...item, description: value }),
+ }));
+ context.subscriptions.push(vscode.debug.registerDebugVisualizationProvider('port.viz', {
+ provideDebugVisualization: ({ variable }) => {
+ const tree = new vscode.DebugVisualization('Show As Tree');
+ tree.iconPath = new vscode.ThemeIcon('list-tree');
+ tree.visualization = { treeId: 'port.tree' };
+ if (variable.name === 'numbers') {
+ return [tree];
+ }
+ const command = new vscode.DebugVisualization('Show Message');
+ command.visualization = { title: 'Show Message', command: 'workbench.action.showCommands' };
+ return [tree, command];
+ },
+ }));
+};
diff --git a/port/fixtures/extensions/debug-visualizer-pair/package.json b/port/fixtures/extensions/debug-visualizer-pair/package.json
new file mode 100644
index 00000000000..1d59b3efc54
--- /dev/null
+++ b/port/fixtures/extensions/debug-visualizer-pair/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "debug-visualizer-pair",
+ "publisher": "port",
+ "version": "0.0.1",
+ "main": "./extension.js",
+ "enabledApiProposals": ["debugVisualization"],
+ "engines": { "vscode": "^1.90.0" },
+ "contributes": {
+ "debugVisualizers": [{ "id": "port.viz", "when": "variableName == 'numbers' || variableName == 'greeting'" }]
+ }
+}
diff --git a/port/fixtures/ui-pair/debug/visualizer.json b/port/fixtures/ui-pair/debug/visualizer.json
new file mode 100644
index 00000000000..b9e59b7a882
--- /dev/null
+++ b/port/fixtures/ui-pair/debug/visualizer.json
@@ -0,0 +1,154 @@
+[
+ {
+ "wait": 25000
+ },
+ {
+ "hotkey": [
+ "cmd",
+ "p"
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "type": "app.js"
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "key": "return",
+ "foreground": true
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "hotkey": [
+ "ctrl",
+ "g"
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "type": "5"
+ },
+ {
+ "key": "return",
+ "foreground": true
+ },
+ {
+ "wait": 500
+ },
+ {
+ "key": "f9",
+ "foreground": true
+ },
+ {
+ "key": "f5",
+ "foreground": true
+ },
+ {
+ "wait": 9000
+ },
+ {
+ "click": [
+ 110,
+ 107
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 2000
+ },
+ {
+ "hover": [
+ 150,
+ 151
+ ]
+ },
+ {
+ "wait": 1500
+ },
+ {
+ "shot": "local"
+ },
+ {
+ "click": [
+ 289,
+ 151
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 2000
+ },
+ {
+ "shot": "tree"
+ },
+ {
+ "hover": [
+ 285,
+ 151
+ ]
+ },
+ {
+ "wait": 300
+ },
+ {
+ "hover": [
+ 289,
+ 151
+ ]
+ },
+ {
+ "wait": 2000
+ },
+ {
+ "shot": "remove-hover"
+ },
+ {
+ "click": [
+ 80,
+ 151
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 2000
+ },
+ {
+ "shot": "tree-open"
+ },
+ {
+ "hover": [
+ 150,
+ 129
+ ]
+ },
+ {
+ "wait": 1000
+ },
+ {
+ "click": [
+ 289,
+ 129
+ ],
+ "foreground": true
+ },
+ {
+ "wait": 1500
+ },
+ {
+ "shot": "pick"
+ },
+ {
+ "key": "escape",
+ "foreground": true
+ }
+]
diff --git a/port/ledger.md b/port/ledger.md
index b8ea10edb9e..59540a71409 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -475,7 +475,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/contrib/commands | workbench contribution | M9 | verified | | runCommands (commands.rs register_run_commands): cargo test -p app commands::, argument checks, spread args, order, stop at a failure; argument errors and the failure notify (cargo test -p app run_commands_argument_errors_notify) |
| workbench/contrib/comments | workbench contribution | M13 | ported | [3 S] comment_node.rs: with a comment in edit, its reactions row sits about 3px left of the reference's (port/results/language-features.md, `steps-comment-menus.json` shot `editing`) | Done: a reply and an edit form per thread and comment, open together (commentReply.ts per CommentThreadWidget): cargo test -p app two_threads_keep_their_reply_forms_open_together; a zone sized by the drawn comment bodies: cargo test -p app a_wrapped_comment_body_grows_its_zone; next/previous thread and Focus Comment on Current Line focus the thread's comments (`commentFocused`, Up/Down between comments, Escape collapses and selects the range): cargo test -p app the_reached_thread_takes_the_focus. Done in diff editors: glyphs, commenting ranges (asked for every side of every multi diff file), range highlights and zones on both sides of the diff editor and of each multi diff file, the other side aligned by a diagonal fill (workbench/editor_view/diff_editor_view.rs, multi_diff_editor_view.rs, diff_editor.rs `additional_heights`): cargo test -p app diff comment; ui-pair `portComments.openDiff` modified, original and multi. Floating widgets on a diff's original side and on both sides of each multi diff file (comment_thread_floating.rs `FloatingHost`, multi_diff_editor_view.rs `multi_diff_floating_hosts`), with `FloatingWidgetRoom` growing a file below its last line (commentThreadFloatingWidgetRoom.ts, `FileDiff.room`): cargo test -p app floating room multi_diff; ui-pair `portComments.openDiff` original and multi with the floating style. Range decorations (commentThreadRangeDecorator.ts and the floating empty-range line, workbench/comment_thread_widget.rs `comment_range_highlights`): cargo test -p app comment_thread_floating. The floating thread style (`comments.thread.experimental.style: floating`; workbench/comment_thread_floating_layout.rs with commentThreadFloatingWidget.test.ts ported, workbench/comment_thread_floating.rs: placement beside the code or its lines in code order, the outline and connector, title drag, edge resize, double-click reset, the layout kept per thread, wheel to the editor): cargo test -p app comment_thread_floating, ui-pair steps-comment-floating.json (port/results/language-features.md Floating comment threads). Done: the Comments panel (workbench/comments_view.rs: resources, threads with author, relative time, first line, range and replies, the unresolved badge, a markdown preview's images as "Image: {alt}" (cargo test -p app a_markdown_comment_previews_its_first_rendered_block), the filter box with Show Resolved/Unresolved and Sort By, its history in the memento's `filterHistory`, Escape and Cmd+Down while `commentsFilterFocus` (cargo test -p app the_filter_keeps_its_history_and_escape_clears_it; no match highlights, as commentsTreeViewer.ts's renderers ignore the filter data), Collapse/Expand All, row selection and keys; hideIfEmpty; a thread row's `commentsView/commentThread/context` inline actions and context menu with the built-in Reply, which reveals the thread with its zone expanded and reply open: cargo test -p app the_thread_menu_replies_to_the_thread), the gutter glyph that toggles the thread (workbench/editor_view/comment_glyph.rs) and the thread widget (workbench/comment_thread_widget.rs: zone, state colors, head with `comments/commentThread/title` actions and Collapse, markdown comments with `code` spans on no `textCodeBlock.background` (cargo test -p app a_comment_s_code_span_draws_no_code_block_background), reply form with `comments/commentThread/context` buttons and Cmd+Enter, the `comments/commentThread/additionalActions` bar under the body (commentThreadAdditionalActions.ts: separator, secondary buttons, a submenu as ButtonWithDropdown, at most 4, in the zone height and the floating widths): cargo test -p app additional_actions_show_under_the_body_and_run_with_the_thread; ui-pair steps-comment-additional.json), each comment (workbench/comment_node.rs: `comments/comment/title` actions, edit mode with `comments/comment/context` buttons, reactions and their picker), commenting ranges with the add glyph, Add Comment and template threads (workbench/commenting_ranges.rs), the comment commands (workbench/comment_navigation.rs: Collapse/Expand All, Expand Unresolved, Toggle Editor Commenting, Focus Comment on Current Line, Dismiss Comment, next/previous thread, commented range and commenting range, reached at the provider's columns unless it holds the cursor: cargo test -p app a_commenting_range_is_reached_at_its_columns_unless_it_holds_the_cursor) and the comments accessibility help: cargo test -p app comment; ui-pair port/results/language-features.md (Comments, Comment editing and commands); Escape keeps a new template open as the reference does (ui-pair steps-comment-escape-typed.json, cargo test -p app dismissing_a_new_template_keeps_it_open). The reply and edit inputs are code editors (simpleCommentEditor.ts: a `comment`-scheme markdown model, word wrap, no glyph margin, line numbers or folding, `scrollBeyondLastLine` false, 5 to 25 lines by `calculateEditorHeight`) that take the focus with `commentEditorFocused`, Cmd+Enter submits and Escape hides; the host gets the input's document and no text editor (workbench/comment_thread_widget.rs `open_comment_editor`, workbench/editor.rs `comment_editor`): cargo test -p app an_expanded_thread_shows_a_zone_and_replies_run_the_form_actions a_comment_switched_to_editing_runs_the_edit_actions; ui-pair steps-comment-reply-editor.json (reply-empty, reply-lines, reply-grown). Comments panel rows: 4px pane inset, 4px radius and the tree's indent guides as the Problems tree (cargo test -p app rows_sit_in_the_pane_s_inset_with_the_tree_s_indent_and_guides; ui-pair steps-comments.json: chevron, name and thread line at the reference's x and y) |
| workbench/contrib/customEditor | workbench contribution | M17 | verified | | Each editor of a custom text editor's resource, the one opened in another group and a split's copy, has a webview of its own (customEditorInput.ts: cargo test -p app each_group_s_custom_text_editor_has_its_own_webview); Opening a custom text editor with `options.selection` reveals it in the panel and leaves the text model's cursor (cargo test -p app a_custom_text_editor_s_navigation_drives_the_outline); A custom document open in another group moves to the active one, or with `supportsMultipleEditorsPerDocument` gets a second editor there (editorResolverService.ts `moveExistingEditorForResource`: cargo test -p app a_custom_document_open_in_another_group_moves_to_the_active_one a_custom_document_with_multiple_editors_opens_one_more_in_the_active_group); `workbench.editorAssociations` merged as editorResolverService.ts `getAllUserAssociationsForSetting`: the workspace's globs before the default's and user's (cargo test -p app a_workspace_association_wins_over_a_user_one_of_the_same_length); Reopen Editor With puts a closed custom or notebook editor's replacement in its place, pinned (editorGroupView.ts `replaceEditors`: cargo test -p app a_reopened_preview_keeps_its_tab_position); Two default editors for one resource warn once and remember the choice per extension glob (editorResolverService.ts `doHandleConflictingDefaults`: cargo test -p app two_default_editors_for_a_resource_ask_once_which_to_keep); the memento's custom editors until the extensions register (cargo test -p app markdown_editor_files_offer); editor resolution by `workbench.editorAssociations` and contributed selectors (editorResolverService.ts ranks), Reopen Editor With picker (`reopenActiveEditorWith`, `workbench.action.reopenWithEditor`), `_workbench.open`, `_workbench.openWith`; `FIXTURE=custom-editor-tests port/tools/webview-check` 8/8; cargo test -p app custom_editors |
-| workbench/contrib/debug | workbench contribution | M16 | ported | [3 S] breakpoint_widget.rs:246: a breakpoint on the stopped line draws the full breakpoint circle inside the stack frame outline where debug.contribution.css's `--vscode-icon-debug-stackframe-dot` overlay draws a small dot (ui-pair `debug/call-stack-menu.json` stopped.png, line 5) <br> [3 S] debug: the Run and Debug activity item shows no badge while stopped where the reference shows "1" (ui-pair `debug/call-stack-menu.json` stopped.png; its source not traced) <br> [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) <br> [3 S] debug status bar: the debug entry reads "Launch server.js" where the reference reads "Launch server.js (debug-node)" (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] debug: while stopped the panel shows a Problems tab beside Debug Console where the reference shows Debug Console alone (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] variable_menu.rs: Copy Value, Copy Expression, Edit Expression and Remove Expression from their keys (Cmd+C, Cmd+Alt+C, Enter, Cmd+Backspace in the views) do nothing: the views keep no tree selection to act on <br> [3 S] variable_menu.rs: a Variables row's menu passes `container` as `{ variablesReference }` only, where variablesView.ts `getVariablesContext` passes the scope's or parent variable's protocol object <br> [3 L] debug visualizers: debugVisualizers.ts, `VisualizedExpression` rows in the Variables view and the hover not ported <br> [3 S] lazy variables: the port's side of ui-pair `debug/lazy-variable.json` eye-hover.png, the eye button's "Click to expand" hover over the debug hover, not yet taken (the Studio's GUI lane stopped at a system prompt); a gpui test covers it <br> [3 S] debug_hover.rs: the hover's find widget starts about 20px right of the reference's and is narrower, and a name matching the find draws on a red box where the reference only recolors it (ui-pair `debug/hover-find.json` hover-find.png) <br> [3 S] debug_view.rs: the Run and Debug container title reads "Run and De..." where the reference reads "Run And D..." (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] view_visibility.rs: the Run and Debug container's `...` menu has no "Debug Console" item and separator above the view toggles, and its button shows no pressed background while the menu is open (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: a stop opens the Run and Debug view for any reason, where debugSession.ts opens it only for `reason === 'breakpoint'`: at the `debugger;` of port/fixtures/debug-node/lazy.js the reference stays on the Explorer (ui-pair `debug/lazy-variable.json`) <br> [3 S] debug_view.rs: scope rows (`Local: main`, `Global`) draw in the regular weight where debugViewlet.css `.debug-pane .scope` sets bold (ui-pair `debug/variables-menu.json`) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request), and the glyph of a breakpoint the frame stops on draws a red filled shape where the reference draws the yellow outlined stack frame with a small red dot (ui-pair `debug/variables-menu.json`, line 5 of app.js) <br> [3 S] debug_toolbar.rs: the floating toolbar draws at the window's top over the title bar where the reference's sits below it over the editor tabs (ui-pair `debug/variables-menu.json`) <br> [3 S] debug_toolbar.rs: with `debug.toolBarLocation` `commandCenter` the label sits right after the actions where the reference centers it behind a `•` separator (ui-pair `debug/toolbar.json`) | ui-pair port/fixtures/debug-node: gutter breakpoint, F5 stops at it, Variables (Local: main), Call Stack with folded deemphasized frames, Breakpoints, Debug Console REPL, toolbar, status bar entry; cargo test -p app debug; the launch picker shrinks to an ellipsis beside a `flex: 1` title (cargo test -p app launch_picker_shrinks; ui-pair menus/view-container-title.json); the container's `...` menu opens below the button, left aligned in a left side bar (cargo test -p app the_debug_container_more_actions); Select Debugger groups the Suggested debuggers and ends with Install, and a file without a debugger offers to find one (cargo test -p app debug_service); own getters come as lazy rows whose `$(eye)` button matches the reference's (ui-pair `debug/lazy-variable.json` hover.png), and the workbench hover draws over the debug hover (cargo test -p app a_workbench_hover_draws_over_the_debug_hover); a complex hover's tree height counts the editor's top in its group, six rows above line 3 of app.js as the reference (cargo test -p app the_tree_height_keeps_an_above_hover_off_the_hovered_line; ui-pair `debug/hover-find.json`); Call Stack frame names, Variables, Watch and hover rows' expression labels in 11px Menlo (cargo test -p app watch_expression_labels_use_the_monospace_font; ui-pair `debug/call-stack-menu.json` stopped.png); Breakpoints header `$(warning)` hint for the debugger's `strings.unverifiedBreakpoints` after breakpointsView.ts's 4s `hintDelayer`, restarted by every breakpoint change (cargo test -p app debug_view; ui-pair port/fixtures/ui-pair/debug/unverified-breakpoints.json with js-debug's unbound math.test.js breakpoint); preLaunchTask, postDebugTask, compound preLaunchTask and the restart tasks through debugTaskRunner.ts's runner with `debug.onTaskErrors`, the remembered task error choice and the slow task notification (cargo test -p app debug_task_runner); Run to Cursor's temporary breakpoint with debugService.ts `runTo`'s 2s verification wait, thread choice from the sessions that verified it, and removal at the next stop or session end (cargo test -p app debug_commands); Debug Console output styled by its SGR sequences with the theme's ANSI colors at contrast 4 (cargo test -p app debug_console debug::ansi); Debug Console filter box (replFilter.ts terms, "Showing N of M" badge, Cmd+F `repl.action.filter`, value and history in workspace storage) and session picker (consoles of the sessions with `hasSeparateRepl`, `mergeWithParent` children in the parent's, selection focuses the session or its stopped child), input history in workspace storage (`debug.repl.history`) (cargo test -p app debug_console); ended sessions stay inactive in the console picker with their output until Clear Console or a start of the same configuration (debugModel.ts `addSession`, repl.ts `sessionsToIgnore`; cargo test -p app an_ended_session_stays_in_the_picker_until_cleared_or_started_again); debugUtils.ts `saveAllBeforeDebugStart` before a start (not for a child session or with `suppressSaveBeforeStart`) and a restart, by `debug.saveBeforeStart` (cargo test -p app a_start_or_restart_saves_the_dirty_editors); triggered breakpoints: debugSession.ts `enableDependentBreakpoints` by `hitBreakpointIds` or the top frame's position sets `sessionsDidTrigger` and sends the files again, continue and the steps wait for it up to 1.5 s (`waitForTriggeredBreakpoints`), a restart clears it (cargo test -p app a_hit_breakpoint_enables_its_dependents); `debug.inlineValues` after the focused frame's lines: the `InlineValuesProvider`s' values (`$provideInlineValues`) or the most specific scopes' variables named on each line, their `formatHoverContent` hover, the 100ms removal on continue (cargo test -p app debug_inline_values); debugHover.ts in place of the editor hover while a frame is focused in the file: the `$provideEvaluatableExpression` range or the dotted path under the mouse, `hover` evaluation or the scopes' variable, Cmd+K Cmd+I focused, Alt for the editor hover, the tree's list keys, Alt+click and Alt+Space toggling the loaded subtree (abstractTree.ts `onSpace`: cargo test -p app alt_click_toggles_the_loaded_subtree), a row click's tree focus, selection and twistie toggle (abstractTree.ts `onViewPointer`: cargo test -p app a_click_on_a_hover_row_focuses_the_tree) and `layoutTree` height, the glyph margin's lockout release, the caret edge nearer the mouse, lazy rows' `$(eye)` button (baseDebugView.ts `lazyButton`, `debug.autoExpandLazyVariables`; cargo test -p app a_lazy_row_takes_its_value_from_the_eye_button), the tree's find widget (abstractTree.ts `FindController`: cargo test -p app the_find_widget_filters_the_hover_tree; ui-pair port/fixtures/ui-pair/debug/hover-find.json) (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); disassemblyView.ts: the `disassemble` requests around the focused frame's instruction pointer, the glyph click's instruction breakpoint (`setInstructionBreakpoints`), the Breakpoints view's instruction rows, `instruction` stepping granularity while the view is active, the table's focus on reload, the list keys' focus, selection and clear, Page Up/Down over the rows' own heights, the hover column border (cargo test -p app disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); Call Stack: js-debug's compact child session merged into its parent's row with modernUI's capitalized state label, the folded frames' common source `origin` (callStackView.ts `CallStackCompressionDelegate`, `ShowMoreRenderer`: cargo test -p app debug_view), the frame's `line:column` count badge and the trees' list focus a right click moves to them (cargo test -p app a_right_clicked_call_stack_row_takes_the_list_focus); the floating toolbar from `MenuId.DebugToolBar` with the extensions' `debug/toolBar` items, and `debug/createConfiguration` items in Select Debugger (cargo test -p app the_debug_toolbar_and_create_configuration_menus_take_contributed_items; ui-pair port/fixtures/ui-pair/debug/call-stack-menu.json); the toolbar's Focus Session select with `multiSessionDebug`, Stop's `MenuId.DebugToolBarStop` dropdown, Alt showing the alt command, `debug.toolBarLocation` docked in the Run and Debug title and `commandCenter` in the command center (debugToolBar.ts, debugActionViewItems.ts `FocusSessionActionViewItem`, commandCenterControl.ts `CommandCenterCenterViewItem`: cargo test -p app debug_toolbar; ui-pair port/fixtures/ui-pair/debug/toolbar.json with `SETTINGS` docked and commandCenter); Variables, Watch and hover row context menus (debug.contribution.ts `DebugVariablesContext`, `DebugWatchContext`, `DebugHoverContext`, watchExpressionsView.ts Copy Expression and Copy All, Set Value through `setVariable` or `setExpression` with the adapter's error under the input, Break on Value Read/Change/Access from the `dataBreakpointInfo` answer: cargo test -p app variable_menu; ui-pair port/fixtures/ui-pair/debug/variables-menu.json); a stop reveals its line centered only when outside the view, after the editor's first layout (debugSource.ts `openInEditor` `CenterIfOutsideViewport`: cargo test -p app a_stop_on_a_line_in_view_keeps_the_scroll; ui-pair port/fixtures/ui-pair/debug/lazy-variable.json); debugQuickAccess.ts `debug ` picks: the launch configurations by folder with Most Recent, their gear to launch.json, Add Configuration..., and Debug: Select and Start Debugging opening it (cargo test -p app the_debug_picker_lists_and_starts_the_launch_configurations; ui-pair port/fixtures/ui-pair/debug/quick-access.json); the first cheap scope expands on a focus change only once the Variables view has shown, as variablesView.ts `renderBody` sets its first input unexpanded (cargo test -p app the_first_scope_expands_only_once_the_variables_view_exists; ui-pair port/fixtures/ui-pair/debug/variables-menu.json `Local: main` collapsed in both); shortcuts in port/notes.md |
+| workbench/contrib/debug | workbench contribution | M16 | ported | [3 S] breakpoint_widget.rs:246: a breakpoint on the stopped line draws the full breakpoint circle inside the stack frame outline where debug.contribution.css's `--vscode-icon-debug-stackframe-dot` overlay draws a small dot (ui-pair `debug/call-stack-menu.json` stopped.png, line 5) <br> [3 S] debug: the Run and Debug activity item shows no badge while stopped where the reference shows "1" (ui-pair `debug/call-stack-menu.json` stopped.png; its source not traced) <br> [3 M] variable_menu.rs: no View Binary Data: debug.contribution.ts registers it only in the rows' `inline` group, and the port's Variables, Watch and hover rows have no inline action bar, no `vscode-debug-memory` file system and no hex editor install prompt (variablesView.ts `VIEW_MEMORY_ID`) <br> [3 S] debug status bar: the debug entry reads "Launch server.js" where the reference reads "Launch server.js (debug-node)" (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] debug: while stopped the panel shows a Problems tab beside Debug Console where the reference shows Debug Console alone (ui-pair `debug/variables-menu.json` watch-menu.png; its source not traced) <br> [3 S] variable_menu.rs: Copy Value, Copy Expression, Edit Expression and Remove Expression from their keys (Cmd+C, Cmd+Alt+C, Enter, Cmd+Backspace in the views) do nothing: the views keep no tree selection to act on <br> [3 S] variable_menu.rs: a Variables row's menu passes `container` as `{ variablesReference }` only, where variablesView.ts `getVariablesContext` passes the scope's or parent variable's protocol object <br> [3 M] debug_visualizers.rs: visualized rows draw only in the Variables view; the Watch view's and the debug hover's expression children keep their plain rows (watchExpressionsView.ts:98, debugHover.ts:142 register `VisualizedVariableRenderer`) <br> [3 S] debug_visualizers.rs `visualizer_icon`: a visualizer whose `iconPath` is a Uri (`iconPath` in extHostDebugService.ts `getIconPathOrClass`) draws an empty button, only `iconClass` codicons draw <br> [3 S] debug_view.rs: while stopped the Variables pane is shorter than the reference's, so Watch starts at y 230 where the reference's starts at y 283 and an expanded Local scope pushes Global under Watch (ui-pair `debug/visualizer.json` local.png; its source not traced) <br> [3 S] lazy variables: the port's side of ui-pair `debug/lazy-variable.json` eye-hover.png, the eye button's "Click to expand" hover over the debug hover, not yet taken (the Studio's GUI lane stopped at a system prompt); a gpui test covers it <br> [3 S] debug_hover.rs: the hover's find widget starts about 20px right of the reference's and is narrower, and a name matching the find draws on a red box where the reference only recolors it (ui-pair `debug/hover-find.json` hover-find.png) <br> [3 S] debug_view.rs: the Run and Debug container title reads "Run and De..." where the reference reads "Run And D..." (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] view_visibility.rs: the Run and Debug container's `...` menu has no "Debug Console" item and separator above the view toggles, and its button shows no pressed background while the menu is open (ui-pair `menus/view-container-title.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: `guess_debugger`'s Select Debugger picker has no "More {0} options..." picks of the dynamic configuration providers (debugAdapterManager.ts `getDynamicProviders`), which the port does not have <br> [3 S] debugQuickAccess.ts: the picker has no dynamic configuration providers' `{label}...` picks with the `contributed` description, where the reference lists `Node.js...` (ui-pair `debug/quick-access.json`, `FOLDER=port/fixtures/debug-node`) <br> [3 S] debug_service.rs: a stop opens the Run and Debug view for any reason, where debugSession.ts opens it only for `reason === 'breakpoint'`: at the `debugger;` of port/fixtures/debug-node/lazy.js the reference stays on the Explorer (ui-pair `debug/lazy-variable.json`) <br> [3 S] debug_view.rs: scope rows (`Local: main`, `Global`) draw in the regular weight where debugViewlet.css `.debug-pane .scope` sets bold (ui-pair `debug/variables-menu.json`) <br> [3 M] debug_editor: the stopped line has no `debug-top-stack-frame-column` inline arrow before the frame's column (callStackEditorContribution.ts `makeStackFrameColumnDecoration`) and no inline breakpoint candidate dots (breakpointEditorContribution.ts, `breakpointLocations` request), and the glyph of a breakpoint the frame stops on draws a red filled shape where the reference draws the yellow outlined stack frame with a small red dot (ui-pair `debug/variables-menu.json`, line 5 of app.js) <br> [3 S] debug_toolbar.rs: the floating toolbar draws at the window's top over the title bar where the reference's sits below it over the editor tabs (ui-pair `debug/variables-menu.json`) <br> [3 S] debug_toolbar.rs: with `debug.toolBarLocation` `commandCenter` the label sits right after the actions where the reference centers it behind a `•` separator (ui-pair `debug/toolbar.json`) | ui-pair port/fixtures/debug-node: gutter breakpoint, F5 stops at it, Variables (Local: main), Call Stack with folded deemphasized frames, Breakpoints, Debug Console REPL, toolbar, status bar entry; cargo test -p app debug; the launch picker shrinks to an ellipsis beside a `flex: 1` title (cargo test -p app launch_picker_shrinks; ui-pair menus/view-container-title.json); the container's `...` menu opens below the button, left aligned in a left side bar (cargo test -p app the_debug_container_more_actions); Select Debugger groups the Suggested debuggers and ends with Install, and a file without a debugger offers to find one (cargo test -p app debug_service); own getters come as lazy rows whose `$(eye)` button matches the reference's (ui-pair `debug/lazy-variable.json` hover.png), and the workbench hover draws over the debug hover (cargo test -p app a_workbench_hover_draws_over_the_debug_hover); a complex hover's tree height counts the editor's top in its group, six rows above line 3 of app.js as the reference (cargo test -p app the_tree_height_keeps_an_above_hover_off_the_hovered_line; ui-pair `debug/hover-find.json`); Call Stack frame names, Variables, Watch and hover rows' expression labels in 11px Menlo (cargo test -p app watch_expression_labels_use_the_monospace_font; ui-pair `debug/call-stack-menu.json` stopped.png); Breakpoints header `$(warning)` hint for the debugger's `strings.unverifiedBreakpoints` after breakpointsView.ts's 4s `hintDelayer`, restarted by every breakpoint change (cargo test -p app debug_view; ui-pair port/fixtures/ui-pair/debug/unverified-breakpoints.json with js-debug's unbound math.test.js breakpoint); preLaunchTask, postDebugTask, compound preLaunchTask and the restart tasks through debugTaskRunner.ts's runner with `debug.onTaskErrors`, the remembered task error choice and the slow task notification (cargo test -p app debug_task_runner); Run to Cursor's temporary breakpoint with debugService.ts `runTo`'s 2s verification wait, thread choice from the sessions that verified it, and removal at the next stop or session end (cargo test -p app debug_commands); Debug Console output styled by its SGR sequences with the theme's ANSI colors at contrast 4 (cargo test -p app debug_console debug::ansi); Debug Console filter box (replFilter.ts terms, "Showing N of M" badge, Cmd+F `repl.action.filter`, value and history in workspace storage) and session picker (consoles of the sessions with `hasSeparateRepl`, `mergeWithParent` children in the parent's, selection focuses the session or its stopped child), input history in workspace storage (`debug.repl.history`) (cargo test -p app debug_console); ended sessions stay inactive in the console picker with their output until Clear Console or a start of the same configuration (debugModel.ts `addSession`, repl.ts `sessionsToIgnore`; cargo test -p app an_ended_session_stays_in_the_picker_until_cleared_or_started_again); debugUtils.ts `saveAllBeforeDebugStart` before a start (not for a child session or with `suppressSaveBeforeStart`) and a restart, by `debug.saveBeforeStart` (cargo test -p app a_start_or_restart_saves_the_dirty_editors); triggered breakpoints: debugSession.ts `enableDependentBreakpoints` by `hitBreakpointIds` or the top frame's position sets `sessionsDidTrigger` and sends the files again, continue and the steps wait for it up to 1.5 s (`waitForTriggeredBreakpoints`), a restart clears it (cargo test -p app a_hit_breakpoint_enables_its_dependents); `debug.inlineValues` after the focused frame's lines: the `InlineValuesProvider`s' values (`$provideInlineValues`) or the most specific scopes' variables named on each line, their `formatHoverContent` hover, the 100ms removal on continue (cargo test -p app debug_inline_values); debugHover.ts in place of the editor hover while a frame is focused in the file: the `$provideEvaluatableExpression` range or the dotted path under the mouse, `hover` evaluation or the scopes' variable, Cmd+K Cmd+I focused, Alt for the editor hover, the tree's list keys, Alt+click and Alt+Space toggling the loaded subtree (abstractTree.ts `onSpace`: cargo test -p app alt_click_toggles_the_loaded_subtree), a row click's tree focus, selection and twistie toggle (abstractTree.ts `onViewPointer`: cargo test -p app a_click_on_a_hover_row_focuses_the_tree) and `layoutTree` height, the glyph margin's lockout release, the caret edge nearer the mouse, lazy rows' `$(eye)` button (baseDebugView.ts `lazyButton`, `debug.autoExpandLazyVariables`; cargo test -p app a_lazy_row_takes_its_value_from_the_eye_button), the tree's find widget (abstractTree.ts `FindController`: cargo test -p app the_find_widget_filters_the_hover_tree; ui-pair port/fixtures/ui-pair/debug/hover-find.json) (cargo test -p app debug_hover; ui-pair port/fixtures/debug-node `greeting` and `numbers` hovers); disassemblyView.ts: the `disassemble` requests around the focused frame's instruction pointer, the glyph click's instruction breakpoint (`setInstructionBreakpoints`), the Breakpoints view's instruction rows, `instruction` stepping granularity while the view is active, the table's focus on reload, the list keys' focus, selection and clear, Page Up/Down over the rows' own heights, the hover column border (cargo test -p app disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints); Call Stack: js-debug's compact child session merged into its parent's row with modernUI's capitalized state label, the folded frames' common source `origin` (callStackView.ts `CallStackCompressionDelegate`, `ShowMoreRenderer`: cargo test -p app debug_view), the frame's `line:column` count badge and the trees' list focus a right click moves to them (cargo test -p app a_right_clicked_call_stack_row_takes_the_list_focus); the floating toolbar from `MenuId.DebugToolBar` with the extensions' `debug/toolBar` items, and `debug/createConfiguration` items in Select Debugger (cargo test -p app the_debug_toolbar_and_create_configuration_menus_take_contributed_items; ui-pair port/fixtures/ui-pair/debug/call-stack-menu.json); the toolbar's Focus Session select with `multiSessionDebug`, Stop's `MenuId.DebugToolBarStop` dropdown, Alt showing the alt command, `debug.toolBarLocation` docked in the Run and Debug title and `commandCenter` in the command center (debugToolBar.ts, debugActionViewItems.ts `FocusSessionActionViewItem`, commandCenterControl.ts `CommandCenterCenterViewItem`: cargo test -p app debug_toolbar; ui-pair port/fixtures/ui-pair/debug/toolbar.json with `SETTINGS` docked and commandCenter); Variables, Watch and hover row context menus (debug.contribution.ts `DebugVariablesContext`, `DebugWatchContext`, `DebugHoverContext`, watchExpressionsView.ts Copy Expression and Copy All, Set Value through `setVariable` or `setExpression` with the adapter's error under the input, Break on Value Read/Change/Access from the `dataBreakpointInfo` answer: cargo test -p app variable_menu; ui-pair port/fixtures/ui-pair/debug/variables-menu.json); a stop reveals its line centered only when outside the view, after the editor's first layout (debugSource.ts `openInEditor` `CenterIfOutsideViewport`: cargo test -p app a_stop_on_a_line_in_view_keeps_the_scroll; ui-pair port/fixtures/ui-pair/debug/lazy-variable.json); debugQuickAccess.ts `debug ` picks: the launch configurations by folder with Most Recent, their gear to launch.json, Add Configuration..., and Debug: Select and Start Debugging opening it (cargo test -p app the_debug_picker_lists_and_starts_the_launch_configurations; ui-pair port/fixtures/ui-pair/debug/quick-access.json); the first cheap scope expands on a focus change only once the Variables view has shown, as variablesView.ts `renderBody` sets its first input unexpanded (cargo test -p app the_first_scope_expands_only_once_the_variables_view_exists; ui-pair port/fixtures/ui-pair/debug/variables-menu.json `Local: main` collapsed in both); shortcuts in port/notes.md |
| workbench/contrib/dropOrPasteInto | workbench contribution | M13 | verified | | commands.ts `configurePreferredPasteAction`/`configurePreferredDropAction`: the widgets' menus and the Paste As pick open user settings JSON at `editor.pasteAs.preferences` or `editor.dropIntoEditor.preferences` (workbench/paste_edits.rs); the `editor.pasteAs.*` and `editor.dropIntoEditor.*` settings come from core-settings.json; ui-pair paste-menu (port/results/language-features.md) |
| workbench/contrib/editSessions | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported |
| workbench/contrib/editTelemetry | workbench contribution | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert |