Visual Studio Code, rebuilt in Rust
Rust
feat(debug): add the Debug Console find widget
rokarturd638fe5a0c58
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 3a8b268cb26..d690b4346a8 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -220,6 +220,7 @@ mod standalone_color_picker;mod inlay_hints;mod debug_inline_values;mod debug_hover;+mod debug_console_find;mod rename;mod links;mod selection_ranges;diff --git a/native/crates/app/src/workbench/debug_commands.rs b/native/crates/app/src/workbench/debug_commands.rsindex 63a57434e58..5af1674acba 100644--- a/native/crates/app/src/workbench/debug_commands.rs+++ b/native/crates/app/src/workbench/debug_commands.rs@@ -529,7 +529,7 @@ impl Workbench {}context.insert(format!("viewContainer.{VIEWLET_ID}.enabled"), json!(true));context.insert(format!("{REPL_VIEW_ID}.active"), json!(true));- context.insert("inDebugRepl".into(), json!(self.debug_console.focus.is_focused(window) || self.debug_console.input_focus.is_focused(window)));+ context.insert("inDebugRepl".into(), json!(self.debug_console.focus.is_focused(window) || self.debug_console.input_focus.is_focused(window) || self.debug_console.find.focus.is_focused(window)));// repl.ts: the input is a code editor and a history navigation widget.if self.debug_console.input_focus.is_focused(window) {for key in ["textInputFocus", "inputFocus", "historyNavigationWidgetFocus", "historyNavigationForwardsEnabled", "historyNavigationBackwardsEnabled"] {diff --git a/native/crates/app/src/workbench/debug_console.rs b/native/crates/app/src/workbench/debug_console.rsindex b14fad0eea6..3bba53e6c63 100644--- a/native/crates/app/src/workbench/debug_console.rs+++ b/native/crates/app/src/workbench/debug_console.rs@@ -10,6 +10,7 @@ use serde_json::json;use super::Workbench;use super::debug_commands::REPL_VIEW_ID;+use super::debug_console_find::{FIND_PADDING, repl_output_label};use super::input_box_view::{InputId, InputLook, InputView};use crate::commands::Outcome;use crate::debug::ansi::AnsiColor;@@ -49,6 +50,7 @@ pub struct DebugConsole {pub(super) selected_session: Option<String>,/// repl.ts `sessionsToIgnore`: inactive sessions whose console was cleared.ignored_sessions: HashSet<String>,+ pub(super) find: super::debug_hover::TreeFind,}impl DebugConsole {@@ -70,6 +72,7 @@ impl DebugConsole {select_commands: 0,selected_session: None,ignored_sessions: HashSet::new(),+ find: super::debug_hover::TreeFind::new(cx),}}}@@ -84,11 +87,13 @@ impl Workbench {open: |workbench, window, cx| workbench.open_debug_console(true, window, cx),render: |workbench, window, cx| workbench.debug_console_body(window, cx).into_any_element(),actions: |workbench, window, cx| {+ let find = workbench.search_action("search", "repl.action.find", true, cx);let clear = workbench.search_action("clear-all", "workbench.debug.panel.action.clearReplAction", true, cx);div().flex().items_center().when(workbench.view_filter_in_header(REPL_VIEW_ID), |actions| actions.child(workbench.debug_console_filter_box(window, cx)))+ .child(workbench.action_bar_item(REPL_VIEW_ID, "find", find, cx)).when(workbench.repl_sessions().len() > 1, |actions| actions.child(workbench.action_bar_item(REPL_VIEW_ID, "session", workbench.repl_session_select(cx), cx))).child(workbench.action_bar_item(REPL_VIEW_ID, "clear", clear, cx)).into_any_element()@@ -180,20 +185,7 @@ impl Workbench {let text = match element {ReplElement::Evaluation { .. } => return true,ReplElement::Variable { .. } => return true,- ReplElement::Output { value, source, count, .. } => {- let mut text = value.clone();- for _ in 1..*count {- if !text.ends_with('\n') {- text.push('\n');- }- text.push_str(value);- }- if let Some((path, _)) = source {- text.push(' ');- text.push_str(path.rsplit('/').next().unwrap_or_default());- }- text- }+ ReplElement::Output { value, source, count, .. } => repl_output_label(value, source.as_ref().map(|(path, _)| path.as_str()), *count),};let mut include_present = false;let mut include_matched = false;@@ -382,6 +374,10 @@ impl Workbench {window.focus(&workbench.debug_console.filter_focus, cx);Outcome::done()});+ self.commands.register("repl.action.find", |workbench, _, window, cx| {+ workbench.open_repl_find(window, cx);+ Outcome::done()+ });self.commands.register("repl.action.acceptInput", |workbench, _, window, cx| {let expression = std::mem::take(&mut workbench.debug_console.input).value;if expression.trim().is_empty() {@@ -449,13 +445,20 @@ impl Workbench {pub(super) fn debug_console_body(&self, window: &Window, cx: &mut Context<Self>) -> Div {let font_size = 12.;let line_height = (font_size * 1.4_f32).round();- let mut rows = div().id("repl-tree").flex_1().min_h_0().overflow_y_scroll().px(px(10.)).py(px(4.)).flex().flex_col();+ let padding = if self.debug_console.find.open { FIND_PADDING } else { 0. };+ let mut rows = div().id("repl-tree").debug_selector(|| "repl-tree".into()).size_full().overflow_y_scroll().px(px(10.)).pt(px(4. + padding)).pb(px(4.)).flex().flex_col();let shown = self.shown_repl_session();+ let mut shown_elements = Vec::new();for (index, element) in self.debug.repl.iter().enumerate() {- if Some(self.repl_owner(repl_element_session(element))) == shown && self.repl_element_visible(element) {+ if Some(self.repl_owner(repl_element_session(element))) != shown || !self.repl_element_visible(element) {+ continue;+ }+ shown_elements.push(element);+ if self.repl_find_keeps(element) {rows = rows.child(self.repl_element(index, element, line_height, cx));}}+ let tree = div().relative().flex_1().min_h_0().child(rows).children(self.repl_find_widget(&shown_elements, window, cx));let focused = self.debug_console.input_focus.is_focused(window);let prompt_color = self.color("debugConsoleInputIcon.foreground");let input = div()@@ -477,7 +480,7 @@ impl Workbench {.text_size(px(font_size)).line_height(px(line_height)).on_mouse_down(gpui::MouseButton::Left, cx.listener(|workbench, _, window, cx| window.focus(&workbench.debug_console.input_focus, cx)))- .child(rows)+ .child(tree).child(input);div().flex_1()@@ -556,7 +559,7 @@ impl Workbench {row.into_any_element()}ReplElement::Variable { variable, severity, .. } => {- let mut label = self.expression_label(variable, &[], None);+ let mut label = self.expression_label(variable, &self.repl_find_name_highlights(variable), None);if variable.name.is_empty() {label = label.text_color(severity_color(*severity));}@@ -564,7 +567,7 @@ impl Workbench {}ReplElement::Evaluation { input, result, .. } => {let icon = self.foreground_or("icon.foreground");- let mut rows = div().flex().flex_col().child(div().flex().items_center().min_h(px(line_height)).child(self.icon("arrow-small-right", 16., 16., icon)).child(input.clone()));+ let mut rows = div().flex().flex_col().child(div().flex().items_center().min_h(px(line_height)).child(self.icon("arrow-small-right", 16., 16., icon)).child(self.repl_input_label(input)));if let Some(result) = result {let shown = Variable { name: String::new(), ..result.clone() };rows = rows.child(div().flex().items_center().min_h(px(line_height)).child(self.icon("chevron-left", 16., 16., icon)).child(self.expression_label(&shown, &[], None)));@@ -676,6 +679,38 @@ mod tests {});}+ #[gpui::test]+ fn the_find_widget_filters_the_console_and_says_when_nothing_matches(cx: &mut TestAppContext) {+ let (workbench, cx) = workbench(cx);+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.debug.repl = vec![output("s", "server started"), output("s", "request failed"), ReplElement::Evaluation { session_id: "s".into(), input: "failures".into(), result: None }];+ workbench.debug_console.selected_session = Some("s".into());+ workbench.open_debug_console(true, window, cx);+ drop(workbench.execute_command("repl.action.find", Vec::new(), window, cx));+ assert!(workbench.debug_console.find.focus.is_focused(window));+ workbench.edit_repl_find_input(|input| input.set_value("fail".into()), cx);+ let keeps = |workbench: &Workbench| workbench.debug.repl.iter().map(|element| workbench.repl_find_keeps(element)).collect::<Vec<_>>();+ assert_eq!(keeps(workbench), [true, true, true], "highlight mode keeps every element");+ workbench.toggle_repl_find(true, cx);+ assert_eq!(keeps(workbench), [false, true, true]);+ let variable = Variable { name: "failed".into(), value: "fail".into(), ..Default::default() };+ assert_eq!(workbench.repl_find_name_highlights(&variable), [0..4], "only the name's match, not the value's");+ let message = |workbench: &Workbench| workbench.repl_find_message(&workbench.debug.repl.iter().collect::<Vec<_>>());+ assert_eq!(message(workbench), None);+ workbench.edit_repl_find_input(|input| input.set_value("zzz".into()), cx);+ assert_eq!(message(workbench).as_deref(), Some("No results found."));+ });+ cx.run_until_parked();+ assert!(cx.debug_bounds("tree-find-input").is_some());+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.close_repl_find(window, cx);+ assert_eq!(workbench.debug.repl.iter().filter(|element| workbench.repl_find_keeps(element)).count(), 3);+ assert!(workbench.debug_console.focus.is_focused(window));+ drop(workbench.execute_command("repl.action.find", Vec::new(), window, cx));+ assert_eq!(workbench.debug_console.find.input.value, "zzz", "a reopened widget starts with the last pattern");+ });+ }+#[gpui::test]fn the_filter_text_and_history_persist_in_workspace_storage(cx: &mut TestAppContext) {let (workbench, cx) = workbench(cx);diff --git a/native/crates/app/src/workbench/debug_console_find.rs b/native/crates/app/src/workbench/debug_console_find.rsnew file mode 100644index 00000000000..e8fdd5c5ccf--- /dev/null+++ b/native/crates/app/src/workbench/debug_console_find.rs@@ -0,0 +1,189 @@+//! The Debug Console tree's find widget: repl.ts `FindReplAction` opens abstractTree.ts `FindController` over the+//! REPL elements, matched by `getKeyboardNavigationLabel` (`IReplElement.toString(true)`).++use std::ops::Range;++use gpui::{Context, Div, HighlightStyle, InteractiveElement, Keystroke, MouseButton, StyledText, Window};+use serde_json::json;++use super::Workbench;+use super::debug_hover::FindQuery;+use super::explorer_find::{INPUT_WIDTH, TreeFindLook, label_matches};+use super::input_box_view::InputId;+use crate::debug::session::{ReplElement, Variable};+use crate::input_box::InputBox;++/// abstractTree.ts `AbstractFindController.open`: `paddingTop: 30` over the rows while the widget shows.+pub(super) const FIND_PADDING: f32 = 30.;++/// The labels a REPL element is found by: `ReplEvaluationInput` and `ReplEvaluationResult` are two tree rows the+/// port draws as one element.+pub(super) fn repl_element_labels(element: &ReplElement) -> Vec<String> {+ match element {+ ReplElement::Output { value, source, count, .. } => vec![repl_output_label(value, source.as_ref().map(|(path, _)| path.as_str()), *count)],+ ReplElement::Variable { variable, .. } => vec![expression_label(variable)],+ ReplElement::Evaluation { input, result, .. } => {+ let mut labels = vec![input.clone()];+ labels.extend(result.iter().map(expression_label));+ labels+ }+ }+}++/// replModel.ts `ReplOutputElement.toString(true)`: the value once per repeat, then the source's file name.+pub(super) fn repl_output_label(value: &str, source_path: Option<&str>, count: u32) -> String {+ let mut text = value.to_owned();+ for _ in 1..count {+ if !text.ends_with('\n') {+ text.push('\n');+ }+ text.push_str(value);+ }+ if let Some(path) = source_path {+ text.push(' ');+ text.push_str(path.rsplit('/').next().unwrap_or_default());+ }+ text+}++/// debugModel.ts `ExpressionContainer.toString`.+fn expression_label(variable: &Variable) -> String {+ format!("{}\n{}", variable.name, variable.value)+}++impl Workbench {+ pub(super) fn repl_find_query(&self) -> Option<FindQuery> {+ let find = &self.debug_console.find;+ if !find.open || find.input.value.is_empty() {+ return None;+ }+ Some(FindQuery { pattern: find.input.value.clone(), fuzzy: self.repl_find_fuzzy(), filter_mode: self.repl_find_filter_mode() })+ }++ fn repl_find_filter_mode(&self) -> bool {+ self.debug_console.find.filter_mode.unwrap_or_else(|| self.setting("workbench.list.defaultFindMode") == json!("filter"))+ }++ fn repl_find_fuzzy(&self) -> bool {+ self.debug_console.find.fuzzy.unwrap_or_else(|| self.setting("workbench.list.defaultFindMatchType") != json!("contiguous"))+ }++ /// `FindFilter.filter` in filter mode: an element shows when one of its labels matches.+ pub(super) fn repl_find_keeps(&self, element: &ReplElement) -> bool {+ let Some(query) = self.repl_find_query().filter(|query| query.filter_mode) else { return true };+ repl_element_labels(element).iter().any(|label| label_matches(&query.pattern, label, query.fuzzy).is_some())+ }++ /// The matched chars of a label, for its `HighlightedLabel`.+ fn repl_find_highlights(&self, label: &str) -> Vec<Range<usize>> {+ self.repl_find_query().and_then(|query| label_matches(&query.pattern, label, query.fuzzy)).unwrap_or_default()+ }++ /// replViewer.ts `renderExpression`: the matches of `name\nvalue` that fall in the name.+ pub(super) fn repl_find_name_highlights(&self, variable: &Variable) -> Vec<Range<usize>> {+ let name_chars = variable.name.chars().count();+ let mut highlights = self.repl_find_highlights(&expression_label(variable));+ highlights.retain(|range| range.start < name_chars);+ for range in &mut highlights {+ range.end = range.end.min(name_chars);+ }+ highlights+ }++ /// `ReplEvaluationInputsRenderer`: the input as a `HighlightedLabel`.+ pub(super) fn repl_input_label(&self, input: &str) -> StyledText {+ let color = self.color("list.highlightForeground");+ let byte = |chars: usize| input.char_indices().nth(chars).map_or(input.len(), |(byte, _)| byte);+ let styles: Vec<_> = self.repl_find_highlights(input).into_iter().map(|range| (byte(range.start)..byte(range.end), HighlightStyle { color: Some(color.into()), ..Default::default() })).collect();+ StyledText::new(input.to_owned()).with_highlights(styles)+ }++ /// repl.ts `openFind`, `AbstractFindController.open`: the widget shows with the last pattern selected, or an+ /// open one takes the focus.+ pub(super) fn open_repl_find(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ let find = &mut self.debug_console.find;+ window.focus(&find.focus.clone(), cx);+ if !find.open {+ find.open = true;+ find.input.set_value(find.previous_pattern.clone());+ }+ find.input.select_all();+ find.history.add_to_history(&find.input.value, true);+ self.blink_caret(InputId::ReplFind, window, cx);+ cx.notify();+ }++ /// `AbstractFindController.close`: the pattern is kept for the next open, and the tree takes the focus.+ pub(super) fn close_repl_find(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ let find = &mut self.debug_console.find;+ if !find.open {+ return;+ }+ find.open = false;+ find.previous_pattern = std::mem::take(&mut find.input.value);+ find.input = InputBox::default();+ find.view.reset();+ window.focus(&self.debug_console.focus, cx);+ cx.notify();+ }++ /// `FindController.mode` and `matchType`.+ pub(super) fn toggle_repl_find(&mut self, mode: bool, cx: &mut Context<Self>) {+ match mode {+ true => self.debug_console.find.filter_mode = Some(!self.repl_find_filter_mode()),+ false => self.debug_console.find.fuzzy = Some(!self.repl_find_fuzzy()),+ }+ cx.notify();+ }++ pub(super) fn edit_repl_find_input(&mut self, edit: impl FnOnce(&mut InputBox), cx: &mut Context<Self>) {+ edit(&mut self.debug_console.find.input);+ cx.notify();+ }++ /// `FindWidget`'s keydown: Enter returns to the tree, Up and Down walk the history, Down past its end returns to+ /// the tree; Escape is the tree's `list.closeFind`.+ pub(super) fn repl_find_input_key(&mut self, keystroke: &Keystroke, window: &mut Window, cx: &mut Context<Self>) -> bool {+ let modifiers = keystroke.modifiers;+ if modifiers.platform || modifiers.alt || modifiers.shift || modifiers.control {+ return false;+ }+ let find = &mut self.debug_console.find;+ match keystroke.key.as_str() {+ "escape" => self.close_repl_find(window, cx),+ "enter" | "down" if keystroke.key == "enter" || find.history.is_last() || find.history.is_nowhere() => {+ find.history.add_to_history(&find.input.value, false);+ window.focus(&self.debug_console.focus, cx);+ }+ "down" => {+ let value = find.history.show_next_value(&find.input.value);+ self.edit_repl_find_input(|input| input.set_value(value), cx);+ }+ "up" => {+ if let Some(value) = find.history.show_previous_value(&find.input.value) {+ self.edit_repl_find_input(|input| input.set_value(value), cx);+ }+ }+ _ => return false,+ }+ cx.notify();+ true+ }++ /// `FindController.render`: "No results found." when no element of the shown console matches.+ pub(super) fn repl_find_message(&self, elements: &[&ReplElement]) -> Option<String> {+ let query = self.repl_find_query()?;+ let found = elements.iter().any(|element| repl_element_labels(element).iter().any(|label| label_matches(&query.pattern, label, query.fuzzy).is_some()));+ (!found && !elements.is_empty()).then(|| "No results found.".to_owned())+ }++ pub(super) fn repl_find_widget(&self, elements: &[&ReplElement], window: &Window, cx: &mut Context<Self>) -> Option<Div> {+ if !self.debug_console.find.open {+ return None;+ }+ let look = TreeFindLook { input: InputId::ReplFind, message: self.repl_find_message(elements), filter_mode: self.repl_find_filter_mode(), fuzzy: self.repl_find_fuzzy(), input_width: INPUT_WIDTH };+ let widget = self.tree_find_widget(look, |workbench, window, cx| workbench.close_repl_find(window, cx), window, cx);+ // The console's mouse down focuses its input.+ Some(widget.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()))+ }+}diff --git a/native/crates/app/src/workbench/debug_hover.rs b/native/crates/app/src/workbench/debug_hover.rsindex dd544a14e27..435b99f7864 100644--- a/native/crates/app/src/workbench/debug_hover.rs+++ b/native/crates/app/src/workbench/debug_hover.rs@@ -68,31 +68,25 @@ pub(super) struct DebugHover {/// Restarts the fade-in of each new value.shows: usize,/// The tree's `FindController`; like the tree, it outlives each shown value.- pub(super) find: DebugHoverFind,+ pub(super) find: TreeFind,}-pub(super) struct DebugHoverFind {+/// abstractTree.ts `FindController` of a tree whose rows are all loaded: the debug hover's and the Debug Console's.+pub(super) struct TreeFind {pub focus: FocusHandle,pub view: InputView,pub input: InputBox,- history: HistoryNavigator,- open: bool,- previous_pattern: String,+ pub(super) history: HistoryNavigator,+ pub(super) open: bool,+ pub(super) previous_pattern: String,/// The Filter and Fuzzy Match toggles; unset follows `workbench.list.defaultFindMode` and `defaultFindMatchType`.- filter_mode: Option<bool>,- fuzzy: Option<bool>,+ pub(super) filter_mode: Option<bool>,+ pub(super) fuzzy: Option<bool>,}-/// The open find widget's pattern the rows are matched against.-struct FindQuery {- pattern: String,- fuzzy: bool,- filter_mode: bool,-}--impl DebugHover {+impl TreeFind {pub fn new(cx: &mut gpui::App) -> Self {- let find = DebugHoverFind {+ TreeFind {focus: cx.focus_handle(),view: InputView::default(),input: InputBox::default(),@@ -101,7 +95,20 @@ impl DebugHover {previous_pattern: String::new(),filter_mode: None,fuzzy: None,- };+ }+ }+}++/// The open find widget's pattern the rows are matched against.+pub(super) struct FindQuery {+ pub(super) pattern: String,+ pub(super) fuzzy: bool,+ pub(super) filter_mode: bool,+}++impl DebugHover {+ pub fn new(cx: &mut gpui::App) -> Self {+ let find = TreeFind::new(cx);DebugHover {position: None,scheduled: None,diff --git a/native/crates/app/src/workbench/explorer_find.rs b/native/crates/app/src/workbench/explorer_find.rsindex 908db2df28d..64a42112393 100644--- a/native/crates/app/src/workbench/explorer_find.rs+++ b/native/crates/app/src/workbench/explorer_find.rs@@ -94,7 +94,7 @@ impl ExplorerFind {impl Workbench {/// listCommands.ts `list.find`, `list.closeFind`, `list.toggleFindMode` and `list.toggleFindMatchType`, for the- /// Explorer, the Outline and the debug hover, the trees with a find widget.+ /// Explorer, the Outline, the debug hover and the Debug Console, the trees with a find widget.pub(super) fn register_explorer_find_commands(&mut self) {type Run = fn(&mut Workbench, &mut Window, &mut Context<Workbench>);let commands: [(&str, Run); 4] = [@@ -123,8 +123,18 @@ impl Workbench {("list.toggleFindMode", |workbench, _, cx| workbench.toggle_debug_hover_find(true, cx)),("list.toggleFindMatchType", |workbench, _, cx| workbench.toggle_debug_hover_find(false, cx)),];- for (((id, run), (_, outline_run)), (_, debug_hover_run)) in commands.into_iter().zip(outline_commands).zip(debug_hover_commands) {+ let repl_commands: [(&str, Run); 4] = [+ ("list.find", |workbench, window, cx| workbench.open_repl_find(window, cx)),+ ("list.closeFind", |workbench, window, cx| workbench.close_repl_find(window, cx)),+ ("list.toggleFindMode", |workbench, _, cx| workbench.toggle_repl_find(true, cx)),+ ("list.toggleFindMatchType", |workbench, _, cx| workbench.toggle_repl_find(false, cx)),+ ];+ for ((((id, run), (_, outline_run)), (_, debug_hover_run)), (_, repl_run)) in commands.into_iter().zip(outline_commands).zip(debug_hover_commands).zip(repl_commands) {self.commands.register(id, move |workbench, _, window, cx| {+ if workbench.debug_console.focus.is_focused(window) || workbench.debug_console.find.focus.is_focused(window) {+ repl_run(workbench, window, cx);+ return Outcome::done();+ }if workbench.debug_hover.shown.is_some() && (workbench.debug_hover_focus.is_focused(window) || workbench.debug_hover.find.focus.is_focused(window)) {debug_hover_run(workbench, window, cx);return Outcome::done();diff --git a/native/crates/app/src/workbench/input_box_view.rs b/native/crates/app/src/workbench/input_box_view.rsindex add3416711d..37d391a420b 100644--- a/native/crates/app/src/workbench/input_box_view.rs+++ b/native/crates/app/src/workbench/input_box_view.rs@@ -27,6 +27,7 @@ pub enum InputId {ExplorerFind,OutlineFind,DebugHoverFind,+ ReplFind,Find,Replace,Search(SearchField),@@ -58,12 +59,13 @@ pub enum InputId {Dialog(usize),}-const INPUTS: [InputId; 30] = [+const INPUTS: [InputId; 31] = [InputId::QuickInput,InputId::Explorer,InputId::ExplorerFind,InputId::OutlineFind,InputId::DebugHoverFind,+ InputId::ReplFind,InputId::Find,InputId::Replace,InputId::KeybindingsSearch,@@ -176,6 +178,7 @@ impl Workbench {InputId::ExplorerFind => &self.explorer.find.view,InputId::OutlineFind => &self.outline_pane.find.view,InputId::DebugHoverFind => &self.debug_hover.find.view,+ InputId::ReplFind => &self.debug_console.find.view,InputId::Find => &self.find.find_view,InputId::Replace => &self.find.replace_view,InputId::Search(field) => &self.search.input(field).view,@@ -214,6 +217,7 @@ impl Workbench {InputId::ExplorerFind => &mut self.explorer.find.view,InputId::OutlineFind => &mut self.outline_pane.find.view,InputId::DebugHoverFind => &mut self.debug_hover.find.view,+ InputId::ReplFind => &mut self.debug_console.find.view,InputId::Find => &mut self.find.find_view,InputId::Replace => &mut self.find.replace_view,InputId::Search(field) => &mut self.search.input_mut(field).view,@@ -258,6 +262,7 @@ impl Workbench {InputId::ExplorerFind => &self.explorer.find.focus,InputId::OutlineFind => &self.outline_pane.find.focus,InputId::DebugHoverFind => &self.debug_hover.find.focus,+ InputId::ReplFind => &self.debug_console.find.focus,InputId::Find => &self.find.find_focus,InputId::Replace => &self.find.replace_focus,InputId::Search(field) => &self.search.input(field).focus,@@ -296,6 +301,7 @@ impl Workbench {InputId::ExplorerFind => Some(&self.explorer.find.input),InputId::OutlineFind => Some(&self.outline_pane.find.input),InputId::DebugHoverFind => Some(&self.debug_hover.find.input),+ InputId::ReplFind => Some(&self.debug_console.find.input),InputId::Find => Some(&self.find.find_input),InputId::Replace => Some(&self.find.replace_input),InputId::Search(field) => Some(&self.search.input(field).value),@@ -371,6 +377,10 @@ impl Workbench {self.edit_debug_hover_find_input(edit, cx);Outcome::done()}+ InputId::ReplFind => {+ self.edit_repl_find_input(edit, cx);+ Outcome::done()+ }InputId::Find | InputId::Replace => {self.edit_find_input(id, edit, window, cx);Outcome::done()@@ -586,6 +596,10 @@ impl Workbench {cx.stop_propagation();return;}+ if id == InputId::ReplFind && self.repl_find_input_key(keystroke, window, cx) {+ cx.stop_propagation();+ return;+ }if matches!(id, InputId::SettingsListKey | InputId::SettingsListValue) && self.settings_list_input_key(keystroke, window, cx) {cx.stop_propagation();return;@@ -710,6 +724,7 @@ impl Workbench {InputId::ExplorerFind => "explorer-find-input-text".into(),InputId::OutlineFind => "outline-find-input-text".into(),InputId::DebugHoverFind => "debug-hover-find-input-text".into(),+ InputId::ReplFind => "repl-find-input-text".into(),InputId::Find => "find-input-text".into(),InputId::Replace => "replace-input-text".into(),InputId::Search(field) => ("search-input-text", field as usize).into(),diff --git a/port/ledger.md b/port/ledger.mdindex 280ea00ee45..cd394a595d3 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -530,7 +530,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 | verified | | workbench/comments_view.rs, workbench/comment_thread_widget.rs, comment_thread_floating.rs, workbench/comment_thread_floating_layout.rs, workbench/comment_node.rs, workbench/commenting_ranges.rs, workbench/comment_navigation.rs, workbench/editor_view/comment_glyph.rs, multi_diff_editor_view.rs: cargo test -p app comment diff floating room multi_diff comment_thread_floating two_threads_keep_their_reply_forms_open_together a_wrapped_comment_body_grows_its_zone the_reached_thread_takes_the_focus a_markdown_comment_previews_its_first_rendered_block the_filter_keeps_its_history_and_escape_clears_it the_thread_menu_replies_to_the_thread a_comment_s_code_span_draws_no_code_block_background additional_actions_show_under_the_body_and_run_with_the_thread a_commenting_range_is_reached_at_its_columns_unless_it_holds_the_cursor dismissing_a_new_template_keeps_it_open an_expanded_thread_shows_a_zone_and_replies_run_the_form_actions a_comment_switched_to_editing_runs_the_edit_actions rows_sit_in_the_pane_s_inset_with_the_tree_s_indent_and_guides (commentThreadFloatingWidget.test.ts); ui-pair `portComments.openDiff` (modified, original, multi, floating), steps-comment-floating.json, steps-comment-additional.json, steps-comment-escape-typed.json, steps-comment-reply-editor.json, steps-comments.json (port/results/language-features.md Comments, Comment editing and commands, Floating comment threads); cargo test -p app reactions_are_action_items_4px_apart || workbench/contrib/customEditor | workbench contribution | M17 | ported | [3 L] custom_editors.rs: a diff always opens in the text diff editor, where customEditors.ts `createDiffEditorInput` opens a diff of resources matching an editor's selector (`workbench.diffEditorAssociations`, `priority.diffEditor`) as a `CustomEditorDiffInput` (customEditorDiffInput.ts, inline) or a `DiffEditorInput` of two `CustomEditorSideBySideDiffInput`s or `CustomEditorInput`s, with the proposed `customEditorDiffs` capabilities (`supportsInlineDiff`, `supportsSideBySideDiff`, used by markdown-language-features' preview); so `activeCustomEditorTextDiff` (contextkeys.ts) is never set and Reopen as Text (editor.contribution.ts `ReOpenInTextEditorAction`, `enableInModalMode`) is missing from the editor title and the modal header | cargo test -p app custom_editors each_group_s_custom_text_editor_has_its_own_webview a_custom_text_editor_s_navigation_drives_the_outline 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 a_workspace_association_wins_over_a_user_one_of_the_same_length a_reopened_preview_keeps_its_tab_position two_default_editors_for_a_resource_ask_once_which_to_keep markdown_editor_files_offer; `FIXTURE=custom-editor-tests port/tools/webview-check` 8/8 |-| workbench/contrib/debug | workbench contribution | M16 | ported | [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 M] debug_console.rs: no Debug Console find: repl.ts `FindReplAction` (`repl.action.find`, the title's `$(search)` at navigation order 15) opens the REPL tree's find widget, where the port's title has no such button (ui-pair `debug/variables-menu.json` watch-menu.png) <br> [3 S] debug_view.rs: the focused frame's Call Stack row draws `list.inactiveSelectionBackground` where the reference's, with js-debug's compact child session, draws none (ui-pair `debug/variables-menu.json` stopped.png; callStackView.ts `updateTreeSelection`, why its selection does not show not traced) <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_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_view.rs: the Variables, Watch, Call Stack, Breakpoints and Loaded Scripts trees draw no indent guides (`workbench.tree.renderIndentGuides`, `tree_guides.rs`; ui-pair `debug/visualizer.json` local.png) <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) (ui-pair `debug/variables-menu.json`, line 5 of app.js) | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists; ui-pair port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, port/fixtures/ui-pair/debug/hover-find.json, port/fixtures/ui-pair/debug/unverified-breakpoints.json, port/fixtures/ui-pair/debug/call-stack-menu.json, port/fixtures/ui-pair/debug/toolbar.json, port/fixtures/ui-pair/debug/variables-menu.json, port/fixtures/ui-pair/debug/lazy-variable.json, port/fixtures/ui-pair/debug/quick-access.json; shortcuts in port/notes.md |+| workbench/contrib/debug | workbench contribution | M16 | ported | [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_view.rs: the focused frame's Call Stack row draws `list.inactiveSelectionBackground` where the reference's, with js-debug's compact child session, draws none (ui-pair `debug/variables-menu.json` stopped.png; callStackView.ts `updateTreeSelection`, why its selection does not show not traced) <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_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_view.rs: the Variables, Watch, Call Stack, Breakpoints and Loaded Scripts trees draw no indent guides (`workbench.tree.renderIndentGuides`, `tree_guides.rs`; ui-pair `debug/visualizer.json` local.png) <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) (ui-pair `debug/variables-menu.json`, line 5 of app.js) | cargo test -p app debug launch_picker_shrinks the_debug_container_more_actions debug_service a_workbench_hover_draws_over_the_debug_hover the_tree_height_keeps_an_above_hover_off_the_hovered_line watch_expression_labels_use_the_monospace_font debug_view debug_task_runner debug_commands debug_console debug::ansi an_ended_session_stays_in_the_picker_until_cleared_or_started_again a_start_or_restart_saves_the_dirty_editors a_hit_breakpoint_enables_its_dependents debug_inline_values debug_hover alt_click_toggles_the_loaded_subtree a_click_on_a_hover_row_focuses_the_tree a_lazy_row_takes_its_value_from_the_eye_button the_find_widget_filters_the_hover_tree disassembly list_tree a_step_in_the_disassembly_view debug::tests::instruction_breakpoints debug::tests::remove_instruction_breakpoints a_right_clicked_call_stack_row_takes_the_list_focus the_debug_toolbar_and_create_configuration_menus_take_contributed_items debug_toolbar variable_menu a_stop_on_a_line_in_view_keeps_the_scroll the_debug_picker_lists_and_starts_the_launch_configurations the_first_scope_expands_only_once_the_variables_view_exists the_find_widget_filters_the_console; ui-pair port/fixtures/debug-node (breakpoint, F5, views, REPL, toolbar, `greeting` and `numbers` hovers), menus/view-container-title.json, port/fixtures/ui-pair/debug/hover-find.json, port/fixtures/ui-pair/debug/unverified-breakpoints.json, port/fixtures/ui-pair/debug/call-stack-menu.json, port/fixtures/ui-pair/debug/toolbar.json, port/fixtures/ui-pair/debug/variables-menu.json, port/fixtures/ui-pair/debug/lazy-variable.json, port/fixtures/ui-pair/debug/quick-access.json; 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 |diff --git a/port/notes.md b/port/notes.mdindex f5500240edc..23cf092cc1c 100644--- a/port/notes.md+++ b/port/notes.md@@ -881,6 +881,7 @@ Scope as in the M19 Work row of port/ledger.md.- Inline values (`workbench/debug_inline_values.rs`; debugEditorContribution.ts): `debug.inlineValues` `on` or `auto` with a provider shows the focused frame's values as `InjectionOwner::DebugInlineValue` text after the lines, `editor.inlineValuesForeground` on `editor.inlineValuesBackground`. Shortcuts: only the active editor shows them, where upstream decorates every editor on the frame's file; the scopes and variables are fetched again, not shared with the Variables view's cache; the text area width stands in for `layoutInfo.width` in the line length cut.- Debug hover (`workbench/debug_hover.rs`; debugHover.ts, debugEditorContribution.ts hover handling): while stopped, the expression at the mouse in the focused frame's file (the first `EvaluatableExpressionProvider` through `$provideEvaluatableExpression`, else `getExactExpressionStartAndEnd`) is evaluated with `context: "hover"` (or looked up in the cheap scopes without `supportsEvaluateForHovers`) after the doubled `editor.hover.delay`, the editor hover off meanwhile; Alt swaps it for the editor hover; Cmd+K Cmd+I shows it at the cursor. The focused tree takes listWidget.ts's and abstractTree.ts's keys through the `list.*` commands (Up, Down, Page Up, Page Down, Home, End, Left, Right, Space, Enter, type navigation by name), Escape clears a selection before it hides the widget; `layoutTree` sizes the tree to its rows plus 10px, at most max(266px, 55% of the editor) and the hovered line's top less 22px. The visualizers are a ledger gap of workbench/contrib/debug; the context menu is under Variable menus. The glyph margin lifts the editor hover lockout; the hovered position is the nearer edge of the character under the mouse, a tab's middle included. Lazy rows (`presentationHint.lazy`) draw the `$(eye)` button after the name in the hover, Variables and Watch trees; a lazy watch, hover or REPL result is evaluated at once (debugModel.ts `evaluateExpression` without `keepLazyVars`). A click on an expandable row focuses and toggles it; with Alt the descendants whose children are loaded follow, the others stay collapsed (indexTreeModel.ts `_setNodeCollapseState` recursive, asyncDataTree.ts collapsing a stale node a deep expand reaches). `list.find` (Cmd+Alt+F, F3) on the focused tree opens abstractTree.ts's find widget over 30px of padding: highlight or filter mode and fuzzy or contiguous match by `workbench.list.defaultFindMode` and `defaultFindMatchType` and the widget's toggles, the filter keeps a collapsed parent of a loaded match, "No results found.", the focus to the first match from the focused row; it outlives each shown value like the tree, and Escape hides the hover and runs `list.closeFind` after it. ui-pair on `port/fixtures/debug-node` (Cmd+K Cmd+I on `numbers` and `greeting`) matches the reference's placement, tree indent and focus outline.- Variable menus (`workbench/variable_menu.rs`; variablesView.ts `openContextMenuForVariableTreeElement`, watchExpressionsView.ts `onContextMenu`, debugContext.ts `getContextForVariable`): a right-click on a Variables, Watch or hover row opens `DebugVariablesContext`, `DebugWatchContext` or `DebugHoverContext` over the row's keys (`variableEvaluateNamePresent`, `variableIsReadonly`, `variableType`, `watchItemType`, `debugType`), with `{ sessionId, container, variable }` for a variable and `{ watchExpressionId, name }` for a watch expression. Copy Value evaluates `evaluateName || value` again with the `clipboard` context when the debugger supports it, else `variables` or `watch`, and falls back to the shown value. Set Value, View Binary Data and the Break on Value items are left out until their requests are ported (ledger debug row); `canViewMemory` is always false.+- Debug Console find (`workbench/debug_console_find.rs`; repl.ts `FindReplAction`, `openFind`): `repl.action.find` (Cmd+Alt+F, the title's `search` before the session picker and Clear Console) opens the tree find widget of the debug hover (`TreeFind`) over the console with 30px of padding; elements are found by `IReplElement.toString(true)`, an evaluation by its input or its result, filter mode drops the elements without a match, evaluation inputs and variable names highlight the matched chars, "No results found." when nothing matches, the pattern is kept for the next open. Shortcuts: the port's console has no row focus, so highlight mode moves no focus to the first match; the item in `MenuId.DebugConsoleContext` waits on that menu, which the port does not have (cargo test -p app the_find_widget_filters_the_console).- Extension host debugging (`extensionHost` launch type; rawDebugSession.ts `launchVsCode`, localProcessExtensionHost.ts `attachSession`, debugService.ts `onAttachSession`): js-debug's `launchVSCode` opens the Extension Development Host window (or reloads the one on the same extension path) with `--debugId`, `--inspect-brk-extensions` and `--extensionEnvironment`; the host it starts has the session attach to the inspector port on a new adapter. Decision: a host with an inspector port runs on Node, since Bun has no V8 inspector; a host without one stays on Bun, and there is no 5870 default port (environmentService.ts gives one to a build from source, which would put every checkout run on Node). The window closes with its current host's exit and at the end of a 'Run Without Debugging' session; a restart reloads it. Check: `cargo test -p app workbench::host::`, ui-pair `debug/extension-host.json` with `FOLDER=port/fixtures/debug-extension` (stops at the breakpoint in `activate`).- Debug visualizers (`workbench/debug_visualizers.rs`): a visualizer contributed with a Uri `iconPath` draws an empty button in the reference too: variablesView.ts builds the action with `class: v.iconClass || 'debug-viz-icon'`, reads no `iconPath`, and no stylesheet of 1.147.0 names `debug-viz-icon` (cargo test -p app debug_visualizers).- Checks: `cargo test -p app debug` and `cargo test -p app testing::`; api-tests `MOCHA_GREP="vscode API - debug"`; `port/fixtures/debug-node` (app.js with launch.json, math.test.js) with `port/fixtures/extensions/tests-provider` through `port/tools/ui-pair`.