Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(tree-views): port checkboxes, drag and drop and $resolve

rokartur2df8fca79aa4
diff --git a/README.md b/README.md
index e664377ccc8..c69b74433be 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@ pie showData
| area | verified | ported | removed | n/a | verified of in scope |
|---|---:|---:|---:|---:|---|
-| src/vs/platform | 69 | 0 | 30 | 13 | `████████████████████ 100%` |
+| src/vs/platform | 68 | 1 | 30 | 13 | `████████████████████ 99%` |
| workbench contribution | 65 | 3 | 30 | 3 | `███████████████████░ 96%` |
| built-in extension | 88 | 1 | 6 | 0 | `████████████████████ 99%` |
-| MainThread* shape (Rust side) | 58 | 1 | 30 | 0 | `████████████████████ 98%` |
+| MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` |
| workbench service | 58 | 7 | 23 | 7 | `██████████████████░░ 89%` |
| src/vs/editor/contrib | 52 | 2 | 2 | 1 | `███████████████████░ 96%` |
| workbench part | 10 | 1 | 2 | 0 | `██████████████████░░ 91%` |
diff --git a/native/crates/app/src/custom_tree.rs b/native/crates/app/src/custom_tree.rs
index 0838db13f14..59d06da2127 100644
--- a/native/crates/app/src/custom_tree.rs
+++ b/native/crates/app/src/custom_tree.rs
@@ -21,6 +21,8 @@ pub struct TreeItem {
pub collapsible: Collapsible,
/// The host's `ITreeItem`, for the label, description, icon, tooltip, command and context value.
pub dto: Value,
+ /// views.ts `ResolvableTreeItem.resolved`: `$resolve` filled in the tooltip and command; a refresh resets it.
+ pub resolved: bool,
}
impl TreeItem {
@@ -30,7 +32,12 @@ impl TreeItem {
Some(2) => Collapsible::Expanded,
_ => Collapsible::None,
};
- TreeItem { handle: dto["handle"].as_str().unwrap_or_default().to_owned(), parent: dto["parentHandle"].as_str().map(str::to_owned), collapsible, dto }
+ TreeItem { handle: dto["handle"].as_str().unwrap_or_default().to_owned(), parent: dto["parentHandle"].as_str().map(str::to_owned), collapsible, dto, resolved: false }
+ }
+
+ /// `ITreeItem.checkbox.isChecked`, for an item with a checkbox.
+ pub fn checked(&self) -> Option<bool> {
+ self.dto["checkbox"]["isChecked"].as_bool()
}
/// treeView.ts `TreeRenderer.renderElement`: the label, else the resource's base name.
@@ -64,6 +71,15 @@ impl TreeItem {
}
}
+/// mainThreadTreeViews.ts `TreeViewDragAndDropController`.
+#[derive(Clone, Debug, Default)]
+pub struct DragAndDrop {
+ pub drop_mime_types: Vec<String>,
+ pub drag_mime_types: Vec<String>,
+ /// `hasHandleDrag`: a drag asks the host for its data transfer (`$handleDrag`).
+ pub has_handle_drag: bool,
+}
+
/// One view's tree. `roots` is `None` until the first fetch (`TreeViewDataProvider.isEmpty`).
#[derive(Default)]
pub struct CustomTree {
@@ -81,6 +97,11 @@ pub struct CustomTree {
pub has_provider: bool,
pub can_select_many: bool,
pub show_collapse_all: bool,
+ /// `$hasResolve`: the host resolves an item's tooltip and command on demand.
+ pub has_resolve: bool,
+ pub manually_manage_checkboxes: bool,
+ /// `TreeViewDragAndDropController`, made when the extension handles a drag or a drop.
+ pub drag_and_drop: Option<DragAndDrop>,
/// Parents whose children are being fetched, so a redraw does not ask again.
pub fetching: HashSet<Option<String>>,
}
@@ -88,14 +109,21 @@ pub struct CustomTree {
impl CustomTree {
/// `TreeViewDataProvider.getChildrenBatch` without a parent clears the items, then `postGetChildren` keeps the
/// new ones; an item the host sent as Expanded starts expanded.
- pub fn set_children(&mut self, parent: Option<&str>, dtos: Vec<Value>) {
+ /// treeView.ts `findCheckboxesUpdated`: unchecked children of a checked parent become checked; those are returned.
+ pub fn set_children(&mut self, parent: Option<&str>, dtos: Vec<Value>) -> Vec<String> {
+ let parent_checked = parent.and_then(|parent| self.items.get(parent)).and_then(TreeItem::checked) == Some(true);
+ let mut checked = Vec::new();
if parent.is_none() {
self.items.clear();
self.children.clear();
}
let mut handles = Vec::new();
for dto in dtos {
- let item = TreeItem::from_dto(dto);
+ let mut item = TreeItem::from_dto(dto);
+ if !self.manually_manage_checkboxes && parent_checked && item.checked() == Some(false) {
+ item.dto["checkbox"]["isChecked"] = Value::Bool(true);
+ checked.push(item.handle.clone());
+ }
if item.collapsible == Collapsible::Expanded && !self.items.contains_key(&item.handle) {
self.expanded.insert(item.handle.clone());
}
@@ -106,17 +134,20 @@ impl CustomTree {
Some(parent) => drop(self.children.insert(parent.to_owned(), handles)),
None => self.roots = Some(handles),
}
+ checked
}
/// `getItemsToRefresh` and `updateTreeItem`: known items take the new properties; the parents whose children
/// changed (an item's handle changed, or the whole tree for `None`) are returned to fetch again.
pub fn refresh(&mut self, items: &serde_json::Map<String, Value>) -> Vec<Option<String>> {
let mut refetch = Vec::new();
+ let mut checkboxes = Vec::new();
for (old_handle, dto) in items {
- if !self.items.contains_key(old_handle) {
- continue;
- }
+ let Some(current) = self.items.get(old_handle) else { continue };
let item = TreeItem::from_dto(dto.clone());
+ if current.checked() != item.checked() {
+ checkboxes.push(item.handle.clone());
+ }
if item.handle == *old_handle {
self.items.insert(item.handle.clone(), item);
continue;
@@ -125,9 +156,51 @@ impl CustomTree {
refetch.push(item.parent.clone());
self.items.insert(item.handle.clone(), item);
}
+ // treeView.ts `refresh`: a refreshed item's children are fetched again, so only its parents follow it.
+ for handle in checkboxes {
+ self.check_parents(&handle, &mut Vec::new());
+ }
refetch
}
+ /// checkbox.ts `setCheckbox`, then treeView.ts `setCascadingCheckboxUpdates` unless the extension manages its
+ /// checkboxes: the fetched children take the item's state, and a parent is checked when all its children are.
+ /// Returns the changed items, the toggled one first.
+ pub fn set_checked(&mut self, handle: &str, checked: bool) -> Vec<String> {
+ let item = self.items.get_mut(handle).expect("a drawn checkbox's item");
+ item.dto["checkbox"]["isChecked"] = Value::Bool(checked);
+ let mut changed = vec![handle.to_owned()];
+ if !self.manually_manage_checkboxes {
+ self.check_children(handle, checked, &mut changed);
+ self.check_parents(handle, &mut changed);
+ }
+ changed
+ }
+
+ fn check_children(&mut self, handle: &str, checked: bool, changed: &mut Vec<String>) {
+ for child in self.children.get(handle).cloned().unwrap_or_default() {
+ let Some(item) = self.items.get_mut(&child).filter(|item| item.checked().is_some_and(|state| state != checked)) else { continue };
+ item.dto["checkbox"]["isChecked"] = Value::Bool(checked);
+ changed.push(child.clone());
+ self.check_children(&child, checked, changed);
+ }
+ }
+
+ fn check_parents(&mut self, handle: &str, changed: &mut Vec<String>) {
+ let Some(parent) = self.items[handle].parent.clone() else { return };
+ let Some(parent_checked) = self.items.get(&parent).and_then(TreeItem::checked) else { return };
+ let Some(children) = self.children.get(&parent) else { return };
+ let states: Vec<bool> = children.iter().filter_map(|child| self.items.get(child)?.checked()).collect();
+ let all_checked = !states.is_empty() && states.iter().all(|checked| *checked);
+ let some_unchecked = states.contains(&false);
+ if all_checked == parent_checked || !all_checked && !some_unchecked {
+ return;
+ }
+ self.items.get_mut(&parent).unwrap().dto["checkbox"]["isChecked"] = Value::Bool(all_checked);
+ changed.push(parent.clone());
+ self.check_parents(&parent, changed);
+ }
+
/// The rows the tree draws: each visible item with its depth, children under an expanded parent once fetched.
pub fn rows(&self) -> Vec<(&TreeItem, usize)> {
let mut rows = Vec::new();
@@ -193,4 +266,27 @@ mod tests {
assert_eq!((tree.items["a/2"].label(), tree.items["a/2"].strikethrough()), ("two".to_string(), true));
assert!(!tree.items.contains_key("x"));
}
+
+ fn checkbox(handle: &str, parent: Option<&str>, checked: bool) -> Value {
+ let mut item = item(handle, parent, if parent.is_none() { 1 } else { 0 });
+ item["checkbox"] = json!({ "isChecked": checked });
+ item
+ }
+
+ #[test]
+ fn a_checkbox_cascades_to_its_children_and_its_parent_follows_them() {
+ let mut tree = CustomTree::default();
+ tree.set_children(None, vec![checkbox("a", None, false)]);
+ tree.set_children(Some("a"), vec![checkbox("a/1", Some("a"), false), checkbox("a/2", Some("a"), true), item("a/3", Some("a"), 0)]);
+ assert_eq!(tree.set_checked("a/1", true), vec!["a/1".to_string(), "a".to_string()]);
+ assert_eq!(tree.set_checked("a", false), vec!["a".to_string(), "a/1".to_string(), "a/2".to_string()]);
+ assert_eq!(tree.set_children(Some("a"), vec![checkbox("a/1", Some("a"), false)]), Vec::<String>::new());
+ tree.set_checked("a", true);
+ assert_eq!(tree.set_children(Some("a"), vec![checkbox("a/1", Some("a"), false)]), vec!["a/1".to_string()], "findCheckboxesUpdated");
+ assert_eq!(tree.items["a/1"].checked(), Some(true));
+
+ tree.manually_manage_checkboxes = true;
+ assert_eq!(tree.set_checked("a/1", false), vec!["a/1".to_string()]);
+ assert_eq!(tree.items["a"].checked(), Some(true));
+ }
}
diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rs
index 3da5284056f..522f94e5da5 100644
--- a/native/crates/app/src/theme.rs
+++ b/native/crates/app/src/theme.rs
@@ -1236,6 +1236,8 @@ fn quick_input_default(key: &str) -> (ColorValue, ColorValue, ColorValue) {
"checkbox.background" => (Key("dropdown.background"), Key("dropdown.background"), Key("dropdown.background")),
"checkbox.foreground" => (Key("dropdown.foreground"), Key("dropdown.foreground"), Key("dropdown.foreground")),
"checkbox.border" => (Key("dropdown.border"), Key("dropdown.border"), Key("dropdown.border")),
+ "checkbox.selectBackground" => (Key("editorWidget.background"), Key("editorWidget.background"), Key("editorWidget.background")),
+ "checkbox.selectBorder" => (Key("icon.foreground"), Key("icon.foreground"), Key("icon.foreground")),
"toolbar.hoverBackground" => (Hex("#5a5d5e50"), Hex("#b8b8b850"), None),
"toolbar.activeBackground" => (Lighten(&Key("toolbar.hoverBackground"), 0.1), Darken(&Key("toolbar.hoverBackground"), 0.1), None),
"dropdown.background" => (Hex("#3C3C3C"), Hex("#FFFFFF"), Hex("#000000")),
@@ -1396,6 +1398,8 @@ fn quick_input_default_hc_light(key: &str) -> ColorValue {
"checkbox.background" => Key("dropdown.background"),
"checkbox.foreground" => Key("dropdown.foreground"),
"checkbox.border" => Key("dropdown.border"),
+ "checkbox.selectBackground" => Key("editorWidget.background"),
+ "checkbox.selectBorder" => Key("icon.foreground"),
"dropdown.background" => Hex("#FFFFFF"),
"dropdown.foreground" => Key("foreground"),
"dropdown.border" => Key("contrastBorder"),
@@ -1619,6 +1623,8 @@ mod tests {
("Dark Modern", "commandCenter.background", "#ffffff0d"),
("Dark Modern", "commandCenter.border", "#cccccc33"),
("Dark Modern", "statusBar.noFolderBackground", "#1f1f1fff"),
+ ("Dark Modern", "checkbox.selectBackground", "#202020ff"),
+ ("Dark Modern", "checkbox.selectBorder", "#ccccccff"),
("Dark Modern", "activityBar.inactiveForeground", "#868686ff"),
("Dark Modern", "statusBarItem.warningBackground", "#7a6400ff"),
("Dark Modern", "charts.red", "#f14c4cff"),
diff --git a/native/crates/app/src/workbench/explorer_actions.rs b/native/crates/app/src/workbench/explorer_actions.rs
index 02ac7cc9910..4d7b11ef8f6 100644
--- a/native/crates/app/src/workbench/explorer_actions.rs
+++ b/native/crates/app/src/workbench/explorer_actions.rs
@@ -875,18 +875,22 @@ impl Render for DraggedItems {
[path] => file_name(path),
paths => paths.len().to_string(),
};
- div()
- .px(px(7.))
- .py(px(1.))
- .rounded(px(10.))
- .text_size(px(12.))
- .bg(self.background)
- .text_color(self.foreground)
- .when_some(self.outline, |image, color| image.border_1().border_color(color))
- .child(label)
+ drag_image(label, self.background, self.foreground, self.outline)
}
}
+pub(super) fn drag_image(label: String, background: Rgba, foreground: Rgba, outline: Option<Rgba>) -> gpui::Div {
+ div()
+ .px(px(7.))
+ .py(px(1.))
+ .rounded(px(10.))
+ .text_size(px(12.))
+ .bg(background)
+ .text_color(foreground)
+ .when_some(outline, |image, color| image.border_1().border_color(color))
+ .child(label)
+}
+
impl Workbench {
/// The items a drag on `path` carries: the selection when it holds `path`, else `path` alone; workspace
/// folders do not move.
diff --git a/native/crates/app/src/workbench/hover.rs b/native/crates/app/src/workbench/hover.rs
index e7dc98ff3d7..cd0ce14f294 100644
--- a/native/crates/app/src/workbench/hover.rs
+++ b/native/crates/app/src/workbench/hover.rs
@@ -65,6 +65,8 @@ pub enum HoverContent {
/// settingsEditorSettingIndicators.ts' policy indicator: the text, then the "View policy settings" action in the
/// hover's status bar.
Policy(String),
+ /// treeView.ts `getHover` of an extension's tree item whose tooltip the host resolves (`$resolve`) when it shows.
+ TreeItem { view: &'static str, handle: String },
}
/// What the target's hover delegate decides.
@@ -373,10 +375,32 @@ impl Workbench {
if matches!(target.content, HoverContent::LanguageStatus) {
self.count_language_status_interaction();
}
+ if let HoverContent::TreeItem { view, handle } = &target.content {
+ self.resolve_tree_item_hover(view, handle.clone(), target.id.clone(), window, cx);
+ }
self.hovers.shown = Some(ShownHover { target, text, fade_in, serial: self.hovers.shown_count, trap_focus: false, return_focus: None, focused_link: None, measured: Rc::default() });
cx.notify();
}
+ /// The content computed after `target`'s hover showed replaces its "Loading..." in place; none hides it.
+ pub(super) fn replace_shown_hover(&mut self, target: &gpui::ElementId, content: Option<HoverContent>, window: &Window) {
+ if !self.hovers.shown.as_ref().is_some_and(|shown| shown.target.id == *target) {
+ return;
+ }
+ let Some(content) = content else {
+ self.hovers.shown = None;
+ return;
+ };
+ let text = self.hover_text(&content, window);
+ let shown = self.hovers.shown.as_mut().expect("checked above");
+ shown.text = text;
+ shown.target.content = content.clone();
+ self.hovers.last = Some(shown.target.clone());
+ if let Some(target) = self.hovers.target.as_mut().filter(|target| target.id == shown.target.id) {
+ target.content = content;
+ }
+ }
+
/// The last hover's `textContent`, which hoverAccessibleViews.ts `ExtHoverAccessibleView` reads.
pub(super) fn last_hover_text(&self, window: &Window) -> Option<String> {
let content = &self.hovers.last.as_ref()?.content;
@@ -530,6 +554,7 @@ impl Workbench {
HoverContent::Action { title, command } => self.keybindings.resolver.append_keybinding(title, command, &self.key_context(window)),
HoverContent::LanguageStatus => self.language_status_hover_text(),
HoverContent::Update => "Update".into(),
+ HoverContent::TreeItem { .. } => "Loading...".into(),
}
}
diff --git a/native/crates/app/src/workbench/tree_view.rs b/native/crates/app/src/workbench/tree_view.rs
index 346a8f8dde7..21fb742ffa2 100644
--- a/native/crates/app/src/workbench/tree_view.rs
+++ b/native/crates/app/src/workbench/tree_view.rs
@@ -7,7 +7,7 @@ use std::sync::{LazyLock, Mutex};
use futures::FutureExt;
use futures::channel::oneshot;
use futures::future::Shared;
-use gpui::{AnyElement, ClickEvent, Context, Div, FocusHandle, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, StatefulInteractiveElement, Styled, Task, Window, div, img, prelude::FluentBuilder, px};
+use gpui::{AnyElement, AppContext, ClickEvent, Context, Div, FocusHandle, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, StatefulInteractiveElement, Styled, Task, Window, div, img, prelude::FluentBuilder, px};
use serde_json::{Value, json};
use super::Workbench;
@@ -16,7 +16,7 @@ use super::markdown_view::MarkdownStyle;
use super::opener::{OpenOptions, Target};
use crate::commands::Outcome;
use crate::contextkey::Expr;
-use crate::custom_tree::{Collapsible, CustomTree, TreeItem};
+use crate::custom_tree::{Collapsible, CustomTree, DragAndDrop, TreeItem};
use crate::markdown::MarkdownString;
use crate::menus::MenuId;
use crate::notifications::{Node, Severity, parse_linked_text};
@@ -51,6 +51,51 @@ pub(super) struct TreeViews {
pub focus: HashMap<String, FocusHandle>,
/// The roots being fetched per view, which a reveal waits for (AsyncDataTree shares a node's refresh).
root_fetches: HashMap<String, Shared<Task<()>>>,
+ /// treeViewsDndService: the host's data transfer of a drag (`$handleDrag`) by operation id, until its drop.
+ drag_transfers: HashMap<String, Shared<Task<Value>>>,
+ /// Each view's drag not dropped yet, released when its next drag starts (`cancelDragOperation`).
+ drag_operations: HashMap<&'static str, String>,
+ /// `DataTransferFileCache`'s request ids.
+ drop_requests: u64,
+}
+
+/// treeView.ts `CustomTreeViewDragAndDrop.onDragStart`: the items a drag on a view's row carries.
+#[derive(Clone)]
+pub(super) struct DraggedTreeItems {
+ view: &'static str,
+ handles: Vec<String>,
+ /// The source controller's `dragMimeTypes`, set empty on the drag (`addExtensionProvidedTransferTypes`).
+ drag_mime_types: Vec<String>,
+ uuid: String,
+ label: String,
+ colors: (gpui::Rgba, gpui::Rgba, Option<gpui::Rgba>),
+}
+
+impl gpui::Render for DraggedTreeItems {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ super::explorer_actions::drag_image(self.label.clone(), self.colors.0, self.colors.1, self.colors.2)
+ }
+}
+
+/// `CustomTreeViewDragAndDrop.treeMimeType`.
+fn tree_mime_type(view: &str) -> String {
+ format!("application/vnd.code.tree.{}", view.to_lowercase())
+}
+
+/// `onDragOver`: the view takes a drag that carries its own tree's type or one of its `dropMimeTypes`.
+fn accepts_drop(view: &str, controller: Option<&DragAndDrop>, dragged: &DraggedTreeItems) -> bool {
+ let Some(controller) = controller.filter(|controller| !controller.drop_mime_types.is_empty()) else { return false };
+ let own = tree_mime_type(view);
+ dragged.mime_types().iter().any(|mime| *mime == own || controller.drop_mime_types.contains(mime))
+}
+
+impl DraggedTreeItems {
+ /// The types on the drag: the source tree's, then its `dragMimeTypes`.
+ fn mime_types(&self) -> Vec<String> {
+ let mut types = vec![tree_mime_type(self.view)];
+ types.extend(self.drag_mime_types.iter().cloned());
+ types
+ }
}
/// Pane ids are `&'static str`; a contributed view's id is interned once, so a reinstall does not leak again.
@@ -229,6 +274,16 @@ impl Workbench {
});
}
tree.can_select_many = arg(1)["canSelectMany"] == true;
+ tree.manually_manage_checkboxes = arg(1)["manuallyManageCheckboxes"] == true;
+ let strings = |key: &str| arg(1)[key].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect();
+ tree.drag_and_drop = (arg(1)["hasHandleDrag"] == true || arg(1)["hasHandleDrop"] == true).then(|| DragAndDrop { drop_mime_types: strings("dropMimeTypes"), drag_mime_types: strings("dragMimeTypes"), has_handle_drag: arg(1)["hasHandleDrag"] == true });
+ let has_resolve = self.host.call("ExtHostTreeViews", "$hasResolve", vec![json!(id)]);
+ let view = id.clone();
+ cx.spawn(async move |workbench, cx| {
+ let has_resolve = has_resolve.await == Ok(Ok(Value::Bool(true)));
+ let _ = workbench.update(cx, |workbench, _| workbench.tree_views.trees.get_mut(&view).map(|tree| tree.has_resolve = has_resolve));
+ })
+ .detach();
let visible = self.tree_views.visible.contains(&id);
self.host.send("ExtHostTreeViews", "$setVisible", vec![json!(id), json!(visible)]);
cx.notify();
@@ -397,8 +452,12 @@ impl Workbench {
group.remove(0);
children[index] = group;
}
+ let mut checked = Vec::new();
for (key, items) in keys.iter().zip(children) {
- tree.set_children(key.as_deref(), items);
+ checked.extend(tree.set_children(key.as_deref(), items));
+ }
+ if !checked.is_empty() {
+ workbench.send_checkbox_states(&id, &checked);
}
cx.notify();
});
@@ -479,6 +538,7 @@ impl Workbench {
let no_provider = (!tree.has_provider).then(|| json!("There is no data provider registered that can provide view data."));
let message = tree.message.as_ref().filter(|message| *message != "").or(no_provider.as_ref()).map(|message| self.tree_view_message(id, message, &context, cx));
let focused = focus.is_focused(window);
+ let controller = tree.drag_and_drop.clone();
let tree_rows = tree.rows();
let depths: Vec<usize> = tree_rows.iter().map(|(_, depth)| depth + 1).collect();
let active: Vec<usize> = tree_rows.iter().enumerate().filter(|(_, (item, _))| tree.selection.contains(&item.handle) || tree.focus.as_ref() == Some(&item.handle)).map(|(index, _)| index).collect();
@@ -496,6 +556,8 @@ impl Workbench {
.overflow_y_scroll()
.children(message)
.children(rows)
+ .can_drop(move |dragged, _, _| dragged.downcast_ref::<DraggedTreeItems>().is_some_and(|dragged| accepts_drop(id, controller.as_ref(), dragged)))
+ .on_drop(cx.listener(move |workbench, dragged: &DraggedTreeItems, _, cx| workbench.drop_tree_items(id, None, dragged, cx)))
.into_any_element();
super::view_panes::ViewPane { id, title, description: tree.description.clone(), actions: Some(actions), draws_more: false, show_actions: focused, body }
}
@@ -597,7 +659,8 @@ impl Workbench {
true => (self.color("list.activeSelectionBackground"), self.theme.color("list.activeSelectionForeground")),
false => (self.color("list.inactiveSelectionBackground"), self.theme.color("list.inactiveSelectionForeground")),
};
- let tooltip = item.dto["tooltip"].as_str().or(item.dto["tooltip"]["value"].as_str()).map(str::to_owned);
+ let hover = self.tree_item_hover(id, tree, item);
+ let checkbox = item.checked().map(|checked| self.tree_item_checkbox(id, &handle, checked, selected, cx));
let label = self.tree_item_label(item);
// `description: true`: the resource's folder as the label service shows it, relative to the workspace.
let description = match item.dto["description"] {
@@ -605,11 +668,30 @@ impl Workbench {
_ => item.description(),
};
let clicked = handle.clone();
- let command = item.dto["command"].clone();
let context_menu = context.clone();
let menu_args = args.clone();
+ let dragged = self.tree_items_drag(id, tree, item);
+ let workbench = cx.entity().downgrade();
+ let controller = tree.drag_and_drop.clone();
+ let can_drop = controller.clone();
+ let drop_background = self.color("list.dropBackground");
+ let dropped_on = handle.clone();
+ let selector = format!("tree-row-{handle}");
div()
.id(row_id.clone())
+ .debug_selector(move || selector)
+ .when_some(dragged, |row, dragged| {
+ row.on_drag(dragged, move |dragged, _, _, cx| {
+ let _ = workbench.update(cx, |workbench, cx| workbench.start_tree_drag(dragged, cx));
+ cx.new(|_| dragged.clone())
+ })
+ })
+ .can_drop(move |dragged, _, _| dragged.downcast_ref::<DraggedTreeItems>().is_some_and(|dragged| accepts_drop(id, can_drop.as_ref(), dragged)))
+ .drag_over::<DraggedTreeItems>(move |row, dragged, _, _| if accepts_drop(id, controller.as_ref(), dragged) { row.bg(drop_background) } else { row })
+ .on_drop(cx.listener(move |workbench, dragged: &DraggedTreeItems, _, cx| {
+ cx.stop_propagation();
+ workbench.drop_tree_items(id, Some(dropped_on.clone()), dragged, cx);
+ }))
.group(row_id.clone())
.relative()
.h(px(22.))
@@ -624,14 +706,15 @@ impl Workbench {
.hover(|row| row.bg(self.color("list.hoverBackground")))
.when(selected, |row| row.bg(selection).when_some(selection_foreground, |row, color| row.text_color(color)))
.when_some(self.theme.color("list.focusOutline").filter(|_| is_focus), |row, color| row.child(div().absolute().inset_0().rounded(px(4.)).border_1().border_color(color)))
- .when_some(tooltip, |row, tooltip| row.child(self.hover_target(("tree-hover", index), HoverContent::Text(tooltip), HoverOptions::mouse())))
+ .when_some(hover, |row, hover| row.child(self.hover_target(("tree-hover", index), hover, HoverOptions::mouse())))
.child(twistie)
+ .children(checkbox)
.children(self.tree_item_icon(item, foreground).map(|icon| icon.ml(px(3.)).mr(px(6.))))
// iconLabel.ts: the label shrinks with an ellipsis once its description is gone.
.child(div().min_w_0().truncate().when(item.strikethrough(), |label| label.line_through()).child(label))
.children(description.map(|description| super::icon_label::label_description().flex_1().min_w_0().truncate().opacity(0.7).child(description)))
.child(div().flex_none().ml_auto().invisible().group_hover(row_id, |actions| actions.visible()).when(selected || is_focus, |actions| actions.visible()).child(actions))
- .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| workbench.tree_item_clicked(id, &clicked, &command, window, cx)))
+ .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| workbench.tree_item_clicked(id, &clicked, window, cx)))
.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {
workbench.show_context_menu(MenuId::ViewItemContext, &context_menu, gpui::Bounds::new(event.position, Default::default()), menu_args.clone(), window, cx);
}))
@@ -672,9 +755,31 @@ impl Workbench {
}
}
- /// treeView.ts: a click selects the item, then runs its command; an item without one toggles
- /// (`expandOnlyOnTwistieClick` is `!!e.command`).
- fn tree_item_clicked(&mut self, id: &'static str, handle: &str, command: &Value, window: &mut Window, cx: &mut Context<Self>) {
+ /// treeView.ts: a click selects the item, then runs its command (`resolveCommand` asks the host first when the
+ /// item has none); an item without a command or a checkbox toggles (`expandOnlyOnTwistieClick`).
+ fn tree_item_clicked(&mut self, id: &'static str, handle: &str, window: &mut Window, cx: &mut Context<Self>) {
+ self.select_clicked_tree_item(id, handle, window, cx);
+ let tree = &self.tree_views.trees[id];
+ let item = &tree.items[handle];
+ let has_command = !item.dto["command"].is_null();
+ let resolves = tree.has_resolve && !item.resolved;
+ if !has_command && item.checked().is_none() {
+ self.toggle_tree_item(id, handle, cx);
+ }
+ if has_command || !resolves {
+ self.run_tree_item_command(id, handle, window, cx);
+ return;
+ }
+ let resolve = self.resolve_tree_item(id, handle, cx);
+ let handle = handle.to_owned();
+ cx.spawn_in(window, async move |workbench, cx| {
+ resolve.await;
+ let _ = workbench.update_in(cx, |workbench, window, cx| workbench.run_tree_item_command(id, &handle, window, cx));
+ })
+ .detach();
+ }
+
+ fn select_clicked_tree_item(&mut self, id: &'static str, handle: &str, window: &mut Window, cx: &mut Context<Self>) {
if let Some(focus) = self.tree_views.focus.get(id).cloned() {
window.focus(&focus, cx);
}
@@ -682,16 +787,181 @@ impl Workbench {
tree.selection = vec![handle.to_owned()];
tree.focus = Some(handle.to_owned());
self.host.send("ExtHostTreeViews", "$setSelectionAndFocus", vec![json!(id), json!([handle]), json!(handle)]);
- match command["id"].as_str() {
- Some(command_id) => {
- let args = command["arguments"].as_array().cloned().unwrap_or_default();
- drop(self.execute_command(command_id, args, window, cx));
- }
- None => self.toggle_tree_item(id, handle, cx),
- }
cx.notify();
}
+ fn run_tree_item_command(&mut self, id: &'static str, handle: &str, window: &mut Window, cx: &mut Context<Self>) {
+ let Some(item) = self.tree_views.trees.get(id).and_then(|tree| tree.items.get(handle)) else { return };
+ let command = item.dto["command"].clone();
+ let Some(command_id) = command["id"].as_str() else { return };
+ let args = command["arguments"].as_array().cloned().unwrap_or_default();
+ drop(self.execute_command(command_id, args, window, cx));
+ }
+
+ /// views.ts `ResolvableTreeItem.resolve`: the host's tooltip and command fill in the ones the item lacks.
+ fn resolve_tree_item(&mut self, id: &'static str, handle: &str, cx: &mut Context<Self>) -> Task<()> {
+ let reply = self.host.call_cancellable("ExtHostTreeViews", "$resolve", vec![json!(id), json!(handle)]);
+ let handle = handle.to_owned();
+ cx.spawn(async move |workbench, cx| {
+ let Ok(Ok(resolved)) = reply.await else { return };
+ let _ = workbench.update(cx, |workbench, cx| {
+ let Some(item) = workbench.tree_views.trees.get_mut(id).and_then(|tree| tree.items.get_mut(&handle)) else { return };
+ for key in ["tooltip", "command"] {
+ if item.dto[key].is_null() && !resolved[key].is_null() {
+ item.dto[key] = resolved[key].clone();
+ }
+ }
+ item.resolved = true;
+ cx.notify();
+ });
+ })
+ }
+
+ /// updatableHoverWidget.ts `update`: "Loading..." shows while the item resolves, then its hover replaces it.
+ pub(super) fn resolve_tree_item_hover(&mut self, id: &'static str, handle: String, target: gpui::ElementId, window: &mut Window, cx: &mut Context<Self>) {
+ let resolve = self.resolve_tree_item(id, &handle, cx);
+ cx.spawn_in(window, async move |workbench, cx| {
+ resolve.await;
+ let _ = workbench.update_in(cx, |workbench, window, cx| {
+ let Some(tree) = workbench.tree_views.trees.get(id) else { return };
+ let Some(item) = tree.items.get(&handle).filter(|item| item.resolved) else { return };
+ let content = workbench.tree_item_hover(id, tree, item);
+ workbench.replace_shown_hover(&target, content, window);
+ cx.notify();
+ });
+ })
+ .detach();
+ }
+
+ /// treeView.ts `getHover`: the tooltip, else the label unless the item has a resource; an item the host
+ /// resolves and has not yet asks for its tooltip when the hover shows.
+ fn tree_item_hover(&self, id: &'static str, tree: &CustomTree, item: &TreeItem) -> Option<HoverContent> {
+ let tooltip = &item.dto["tooltip"];
+ if tree.has_resolve && !item.resolved && !tooltip.is_string() {
+ return Some(HoverContent::TreeItem { view: id, handle: item.handle.clone() });
+ }
+ match tooltip {
+ Value::Null if item.dto["resourceUri"].is_null() => Some(HoverContent::Text(item.label())),
+ Value::Null => None,
+ Value::String(text) if text.is_empty() => None,
+ Value::String(text) => Some(HoverContent::Text(text.clone())),
+ markdown => Some(HoverContent::Markdown(markdown.clone())),
+ }
+ }
+
+ /// checkbox.ts `TreeItemCheckbox`: a 15px toggle (`size: 15`) in views.css's checkbox box.
+ fn tree_item_checkbox(&self, id: &'static str, handle: &str, checked: bool, selected: bool, cx: &mut Context<Self>) -> gpui::Stateful<Div> {
+ let (background, border) = match selected {
+ true => (self.color("checkbox.selectBackground"), self.color("checkbox.selectBorder")),
+ false => (self.color("checkbox.background"), self.color("checkbox.border")),
+ };
+ let selector = format!("tree-checkbox-{handle}");
+ let toggled = handle.to_owned();
+ div()
+ .id(gpui::SharedString::from(selector.clone()))
+ .debug_selector(move || selector)
+ .size(px(16.))
+ .flex_none()
+ .ml(px(3.))
+ .mt(px(3.))
+ .mb(px(3.))
+ .mr(px(6.))
+ .flex()
+ .items_center()
+ .justify_center()
+ .rounded(px(3.))
+ .border_1()
+ .border_color(border)
+ .bg(background)
+ .when(checked, |checkbox| checkbox.child(self.icon("check", 13., 13., self.color("checkbox.foreground"))))
+ .on_click(cx.listener(move |workbench, _: &ClickEvent, window, cx| {
+ cx.stop_propagation();
+ workbench.tree_checkbox_clicked(id, &toggled, window, cx);
+ }))
+ }
+
+ /// checkbox.ts `setCheckbox` then mainThreadTreeViews.ts `$changeCheckboxState`; the list still selects the row,
+ /// while `onDidOpen` skips the command of a click on the checkbox.
+ fn tree_checkbox_clicked(&mut self, id: &'static str, handle: &str, window: &mut Window, cx: &mut Context<Self>) {
+ let tree = self.tree_views.trees.get_mut(id).expect("a drawn checkbox's tree");
+ let checked = tree.items[handle].checked() != Some(true);
+ let changed = tree.set_checked(handle, checked);
+ self.send_checkbox_states(id, &changed);
+ self.select_clicked_tree_item(id, handle, window, cx);
+ }
+
+ fn send_checkbox_states(&self, id: &str, handles: &[String]) {
+ let tree = &self.tree_views.trees[id];
+ let updates: Vec<Value> = handles.iter().map(|handle| json!({ "treeItemHandle": handle, "newState": tree.items[handle].checked() == Some(true) })).collect();
+ self.host.send("ExtHostTreeViews", "$changeCheckboxState", vec![json!(id), json!(updates)]);
+ }
+
+ /// `onDragStart`: the selection when it holds the item, else the item, from a view whose extension handles drags
+ /// or drops (`getDragURI`); the drag image shows `getDragLabel`.
+ fn tree_items_drag(&self, id: &'static str, tree: &CustomTree, item: &TreeItem) -> Option<DraggedTreeItems> {
+ let controller = tree.drag_and_drop.as_ref()?;
+ let handles = match tree.selection.contains(&item.handle) {
+ true => tree.selection.clone(),
+ false => vec![item.handle.clone()],
+ };
+ let label = match handles.len() {
+ 1 => item.label(),
+ count => count.to_string(),
+ };
+ let colors = (self.color("list.activeSelectionBackground"), self.foreground_or("list.activeSelectionForeground"), self.theme.color("list.focusOutline").or(self.theme.color("focusBorder")));
+ Some(DraggedTreeItems { view: id, handles, drag_mime_types: controller.drag_mime_types.clone(), uuid: crate::debug::generate_uuid(), label, colors })
+ }
+
+ /// `addExtensionProvidedTransferTypes`: the view's previous drag is released, and an extension that handles
+ /// drags is asked for this one's data transfer (`$handleDrag`).
+ fn start_tree_drag(&mut self, dragged: &DraggedTreeItems, cx: &mut Context<Self>) {
+ if let Some(previous) = self.tree_views.drag_operations.insert(dragged.view, dragged.uuid.clone()) {
+ self.tree_views.drag_transfers.remove(&previous);
+ self.host.send("ExtHostTreeViews", "$releaseDragOperation", vec![json!(previous)]);
+ }
+ if !self.tree_views.trees.get(dragged.view).and_then(|tree| tree.drag_and_drop.as_ref()).is_some_and(|controller| controller.has_handle_drag) {
+ return;
+ }
+ let reply = self.host.call_cancellable("ExtHostTreeViews", "$handleDrag", vec![json!(dragged.view), json!(dragged.handles), json!(dragged.uuid)]);
+ let transfer = cx.background_executor().spawn(async move { reply.await.ok().and_then(Result::ok).unwrap_or_default() }).shared();
+ self.tree_views.drag_transfers.insert(dragged.uuid.clone(), transfer);
+ }
+
+ /// `CustomTreeViewDragAndDrop.drop`: the drag's types the view takes (its own tree's with the source items),
+ /// then the host's data transfer of the drag, go to `$handleDrop` with the target item, if any.
+ fn drop_tree_items(&mut self, id: &'static str, target: Option<String>, dragged: &DraggedTreeItems, cx: &mut Context<Self>) {
+ self.tree_views.drag_operations.remove(dragged.view);
+ let Some(controller) = self.tree_views.trees.get(id).and_then(|tree| tree.drag_and_drop.clone()) else { return };
+ let own = tree_mime_type(id);
+ let mut items = Vec::new();
+ let mut source = None;
+ for mime in dragged.mime_types() {
+ let value = if mime == own {
+ source = Some(dragged);
+ json!({ "id": dragged.view, "itemHandles": dragged.handles }).to_string()
+ } else if controller.drop_mime_types.contains(&mime) {
+ String::new()
+ } else {
+ continue;
+ };
+ items.push(json!([mime, { "id": crate::debug::generate_uuid(), "asString": value }]));
+ }
+ let request = self.tree_views.drop_requests;
+ self.tree_views.drop_requests += 1;
+ let transfer = self.tree_views.drag_transfers.remove(&dragged.uuid);
+ let (source_view, source_handles) = (source.map(|source| source.view), source.map(|source| source.handles.clone()));
+ let uuid = dragged.uuid.clone();
+ cx.spawn(async move |workbench, cx| {
+ if let Some(transfer) = transfer {
+ items.extend(transfer.await["items"].as_array().cloned().unwrap_or_default());
+ }
+ // The main thread passes `CancellationToken.None` mid-arguments, which reaches the host as plain data.
+ let args = vec![json!(id), json!(request), json!({ "items": items }), json!(target), json!({ "isCancellationRequested": false }), json!(uuid), json!(source_view), json!(source_handles)];
+ let _ = workbench.update(cx, |workbench, _| workbench.host.send("ExtHostTreeViews", "$handleDrop", args));
+ })
+ .detach();
+ }
+
fn toggle_tree_item(&mut self, id: &'static str, handle: &str, cx: &mut Context<Self>) {
let tree = self.tree_views.trees.get_mut(id).expect("a drawn row's tree");
let expanded = !tree.expanded.remove(handle);
diff --git a/native/crates/app/src/workbench/tree_view/tests.rs b/native/crates/app/src/workbench/tree_view/tests.rs
index 974ec18ee90..751fb367948 100644
--- a/native/crates/app/src/workbench/tree_view/tests.rs
+++ b/native/crates/app/src/workbench/tree_view/tests.rs
@@ -46,14 +46,22 @@ fn request(workbench: &gpui::Entity<Workbench>, cx: &mut VisualTestContext, meth
/// The host messages sent since the last call, as `method(args)`; `$getChildren` is answered from `children`.
fn sent(receiver: &Receiver<HostMessage>, cx: &mut VisualTestContext, children: &[(Value, Value)]) -> Vec<String> {
+ let answer = |method: &str, args: &[Value]| match method {
+ "$getChildren" => children.iter().find(|(parents, _)| args.get(1) == Some(parents)).map_or(Value::Null, |(_, answer)| answer.clone()),
+ _ => Value::Null,
+ };
+ sent_with(receiver, cx, answer).into_iter().map(|(method, args)| format!("{method}({})", Value::Array(args))).collect()
+}
+
+/// The host messages sent since the last call, each request answered by `answer`.
+fn sent_with(receiver: &Receiver<HostMessage>, cx: &mut VisualTestContext, answer: impl Fn(&str, &[Value]) -> Value) -> Vec<(&'static str, Vec<Value>)> {
draw(cx);
let mut sent = Vec::new();
for message in receiver.try_iter() {
- sent.push(format!("{}({})", message.method, Value::Array(message.args.clone())));
if let Some(reply) = message.reply {
- let answer = children.iter().find(|(parents, _)| message.args.get(1) == Some(parents)).map_or(Value::Null, |(_, answer)| answer.clone());
- let _ = reply.send(Ok(answer));
+ let _ = reply.send(Ok(answer(message.method, &message.args)));
}
+ sent.push((message.method, message.args));
}
draw(cx);
sent
@@ -78,7 +86,7 @@ fn a_collapsed_view_fetches_nothing_until_its_pane_expands(cx: &mut TestAppConte
let (workbench, cx, receiver) = workbench_with("collapsed", cx);
assert_eq!(workbench.read_with(cx, |workbench, _| workbench.shown_tree_views()), vec![VIEW]);
request(&workbench, cx, "$registerTreeViewDataProvider", json!([VIEW, { "showCollapseAll": false }]));
- assert_eq!(sent(&receiver, cx, &[]), vec![format!("$setVisible([\"{VIEW}\",false])")]);
+ assert_eq!(sent(&receiver, cx, &[]), vec![format!("$hasResolve([\"{VIEW}\"])"), format!("$setVisible([\"{VIEW}\",false])")]);
request(&workbench, cx, "$refresh", json!([VIEW]));
assert_eq!(sent(&receiver, cx, &[]), Vec::<String>::new(), "treeView.ts: no tree, no fetch");
@@ -125,6 +133,108 @@ fn reveal_opens_the_view_expands_the_parents_and_selects_the_item(cx: &mut TestA
assert_eq!(reply.try_recv().unwrap(), Some(Ok(Value::Null)), "a view whose when is false has no tree to reveal in");
}
+/// The tree view expanded, registered with `options`, its items fetched from `children` (by parents, as `sent`).
+fn shown_tree<'a>(name: &str, options: Value, children: &[(Value, Value)], has_resolve: bool, cx: &'a mut TestAppContext) -> (gpui::Entity<Workbench>, &'a mut VisualTestContext, Receiver<HostMessage>) {
+ let (workbench, cx, receiver) = workbench_with(name, cx);
+ workbench.update(cx, |workbench, cx| workbench.expand_pane(crate::workbench::view_panes::PaneContainer::Explorer, VIEW, cx));
+ request(&workbench, cx, "$registerTreeViewDataProvider", json!([VIEW, options]));
+ let answer = |method: &str, args: &[Value]| match method {
+ "$hasResolve" => json!(has_resolve),
+ "$getChildren" => children.iter().find(|(parents, _)| args[1] == *parents).map_or(Value::Null, |(_, answer)| answer.clone()),
+ _ => Value::Null,
+ };
+ for _ in 0..3 {
+ sent_with(&receiver, cx, answer);
+ }
+ (workbench, cx, receiver)
+}
+
+fn checkbox_item(handle: &str, parent: Option<&str>, state: u64, checked: bool) -> Value {
+ let mut item = item(handle, parent, state);
+ item["checkbox"] = json!({ "isChecked": checked });
+ item
+}
+
+/// checkbox.ts `TreeItemCheckbox`: a click toggles the box, cascades to the parent (`setCascadingCheckboxUpdates`)
+/// and tells the host (`$changeCheckboxState`); the row is selected, but neither toggles nor runs its command.
+#[gpui::test]
+fn a_checkbox_click_sends_the_changed_states_and_selects_the_row(cx: &mut TestAppContext) {
+ let children = [(Value::Null, json!([[0, checkbox_item("a", None, 2, false)]])), (json!(["a"]), json!([[0, checkbox_item("a/1", Some("a"), 0, false), checkbox_item("a/2", Some("a"), 0, true)]]))];
+ let (workbench, cx, receiver) = shown_tree("checkbox", json!({}), &children, false, cx);
+ assert_eq!(rows(&workbench, cx), vec![("a".into(), 0), ("a/1".into(), 1), ("a/2".into(), 1)]);
+
+ let checkbox = cx.debug_bounds("tree-checkbox-a/1").expect("a/1 draws its checkbox").center();
+ cx.simulate_click(checkbox, gpui::Modifiers::none());
+ assert_eq!(sent(&receiver, cx, &[]), vec![
+ format!("$changeCheckboxState([\"{VIEW}\",[{{\"treeItemHandle\":\"a/1\",\"newState\":true}},{{\"treeItemHandle\":\"a\",\"newState\":true}}]])"),
+ format!("$setSelectionAndFocus([\"{VIEW}\",[\"a/1\"],\"a/1\"])"),
+ ]);
+ let checked = workbench.read_with(cx, |workbench, _| ["a", "a/1", "a/2"].map(|handle| workbench.tree_views.trees[VIEW].items[handle].checked()));
+ assert_eq!(checked, [Some(true); 3]);
+
+ let parent = cx.debug_bounds("tree-row-a").unwrap().center();
+ cx.simulate_click(parent, gpui::Modifiers::none());
+ assert_eq!(sent(&receiver, cx, &[]), vec![format!("$setSelectionAndFocus([\"{VIEW}\",[\"a\"],\"a\"])")], "an item with a checkbox expands by its twistie only");
+}
+
+/// views.ts `ResolvableTreeItem`: the hover of an item without a tooltip shows "Loading..." while `$resolve` runs,
+/// then the resolved tooltip; a click on an item without a command resolves it and runs the resolved one.
+#[gpui::test]
+fn an_item_resolves_its_tooltip_on_hover_and_its_command_on_click(cx: &mut TestAppContext) {
+ let roots = [(Value::Null, json!([[0, item("a", None, 0), item("b", None, 0)]]))];
+ let (workbench, cx, receiver) = shown_tree("resolve", json!({}), &roots, true, cx);
+ let ran = std::rc::Rc::new(std::cell::Cell::new(false));
+ let flag = ran.clone();
+ workbench.update(cx, |workbench, _| {
+ workbench.commands.register("test.resolved", move |_, _, _, _| {
+ flag.set(true);
+ Outcome::done()
+ })
+ });
+ let shown = |cx: &mut VisualTestContext| workbench.read_with(cx, |workbench, _| workbench.hovers.shown_text().map(str::to_owned));
+
+ let (a, b) = (cx.debug_bounds("tree-row-a").unwrap().center(), cx.debug_bounds("tree-row-b").unwrap().center());
+ cx.simulate_mouse_move(a, None, gpui::Modifiers::none());
+ cx.executor().advance_clock(std::time::Duration::from_millis(1500));
+ cx.run_until_parked();
+ assert_eq!(shown(cx).as_deref(), Some("Loading..."));
+ let resolved = sent_with(&receiver, cx, |method, _| if method == "$resolve" { json!({ "handle": "a", "tooltip": "Resolved A" }) } else { Value::Null });
+ assert_eq!(resolved, vec![("$resolve", vec![json!(VIEW), json!("a")])]);
+ assert_eq!(shown(cx).as_deref(), Some("Resolved A"));
+
+ cx.simulate_click(b, gpui::Modifiers::none());
+ let messages = sent_with(&receiver, cx, |method, _| if method == "$resolve" { json!({ "handle": "b", "command": { "id": "test.resolved" } }) } else { Value::Null });
+ assert!(messages.contains(&("$resolve", vec![json!(VIEW), json!("b")])), "{messages:?}");
+ assert!(ran.get(), "resolveCommand runs the command $resolve gave");
+}
+
+/// treeView.ts `CustomTreeViewDragAndDrop`: a row dragged onto another asks the host for the drag's data
+/// (`$handleDrag`), then drops the tree's own type with the source items and that data on the target (`$handleDrop`).
+#[gpui::test]
+fn a_row_dragged_onto_another_sends_handle_drag_then_handle_drop(cx: &mut TestAppContext) {
+ let roots = [(Value::Null, json!([[0, item("a", None, 0), item("b", None, 0)]]))];
+ let tree_mime = format!("application/vnd.code.tree.{VIEW}");
+ let options = json!({ "hasHandleDrag": true, "hasHandleDrop": true, "dropMimeTypes": [tree_mime], "dragMimeTypes": ["text/x-test"] });
+ let (_workbench, cx, receiver) = shown_tree("drag", options, &roots, false, cx);
+ let (a, b) = (cx.debug_bounds("tree-row-a").unwrap().center(), cx.debug_bounds("tree-row-b").unwrap().center());
+
+ cx.simulate_mouse_down(a, gpui::MouseButton::Left, gpui::Modifiers::none());
+ cx.simulate_mouse_move(a + gpui::point(gpui::px(0.), gpui::px(5.)), gpui::MouseButton::Left, gpui::Modifiers::none());
+ let transfer = json!({ "items": [["text/x-test", { "id": "1", "asString": "payload" }]] });
+ let dragged = sent_with(&receiver, cx, |method, _| if method == "$handleDrag" { transfer.clone() } else { Value::Null });
+ let [("$handleDrag", args)] = dragged.as_slice() else { panic!("{dragged:?}") };
+ assert_eq!(args[..2], [json!(VIEW), json!(["a"])]);
+ let uuid = args[2].clone();
+
+ cx.simulate_mouse_move(b, gpui::MouseButton::Left, gpui::Modifiers::none());
+ cx.simulate_mouse_up(b, gpui::MouseButton::Left, gpui::Modifiers::none());
+ let dropped = sent_with(&receiver, cx, |_, _| Value::Null);
+ let [("$handleDrop", args)] = dropped.as_slice() else { panic!("{dropped:?}") };
+ let items: Vec<(&str, &str)> = args[2]["items"].as_array().unwrap().iter().map(|item| (item[0].as_str().unwrap(), item[1]["asString"].as_str().unwrap())).collect();
+ assert_eq!(items, [(tree_mime.as_str(), format!("{{\"id\":\"{VIEW}\",\"itemHandles\":[\"a\"]}}").as_str()), ("text/x-test", "payload")]);
+ assert_eq!([&args[0], &args[3], &args[5], &args[6], &args[7]], [&json!(VIEW), &json!("b"), &uuid, &json!(VIEW), &json!(["a"])]);
+}
+
#[test]
fn a_markdown_message_turns_lone_links_into_buttons() {
use super::MessageLine::*;
diff --git a/port/fixtures/extensions/tree-checkbox/extension.js b/port/fixtures/extensions/tree-checkbox/extension.js
new file mode 100644
index 00000000000..2f1d5fd3b55
--- /dev/null
+++ b/port/fixtures/extensions/tree-checkbox/extension.js
@@ -0,0 +1,35 @@
+// A tree whose items have checkboxes, tooltips the extension resolves on hover, and a drag and drop controller that moves an item under another.
+const vscode = require('vscode');
+
+exports.activate = context => {
+ const children = { '': ['Fruits', 'Vegetables'], Fruits: ['Apple', 'Banana'], Vegetables: ['Carrot'] };
+ const changed = new vscode.EventEmitter();
+ const provider = {
+ onDidChangeTreeData: changed.event,
+ getChildren: item => children[item ?? ''] ?? [],
+ getTreeItem: label => {
+ const item = new vscode.TreeItem(label, children[label] ? vscode.TreeItemCollapsibleState.Expanded : vscode.TreeItemCollapsibleState.None);
+ item.checkboxState = label === 'Banana' ? vscode.TreeItemCheckboxState.Checked : vscode.TreeItemCheckboxState.Unchecked;
+ return item;
+ },
+ resolveTreeItem: (item, label) => {
+ item.tooltip = `Resolved ${label}`;
+ return new Promise(resolve => setTimeout(() => resolve(item), 1500));
+ },
+ };
+ const mime = 'application/vnd.code.tree.portTreeCheckbox.view';
+ let dragged = [];
+ const dragAndDropController = {
+ dropMimeTypes: [mime],
+ dragMimeTypes: [],
+ handleDrag: source => { dragged = source; },
+ handleDrop: async target => {
+ for (const label of dragged) {
+ for (const key of Object.keys(children)) children[key] = children[key].filter(child => child !== label);
+ (children[target ?? ''] ??= []).push(label);
+ }
+ changed.fire();
+ },
+ };
+ context.subscriptions.push(vscode.window.createTreeView('portTreeCheckbox.view', { treeDataProvider: provider, dragAndDropController }));
+};
diff --git a/port/fixtures/extensions/tree-checkbox/package.json b/port/fixtures/extensions/tree-checkbox/package.json
new file mode 100644
index 00000000000..0d5f2cd8cd1
--- /dev/null
+++ b/port/fixtures/extensions/tree-checkbox/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "tree-checkbox",
+ "publisher": "port",
+ "displayName": "Port Tree Checkbox",
+ "version": "0.0.1",
+ "description": "A tree view with checkboxes, tooltips resolved on hover and drag and drop, for port/tools/ui-pair.",
+ "engines": { "vscode": "^1.100.0" },
+ "main": "./extension.js",
+ "activationEvents": ["onStartupFinished"],
+ "contributes": {
+ "views": { "explorer": [{ "id": "portTreeCheckbox.view", "name": "Tree Checkbox" }] }
+ }
+}
diff --git a/port/fixtures/extensions/ui-tree-checkbox.json b/port/fixtures/extensions/ui-tree-checkbox.json
new file mode 100644
index 00000000000..9d7a634dfdc
--- /dev/null
+++ b/port/fixtures/extensions/ui-tree-checkbox.json
@@ -0,0 +1,17 @@
+[
+ {"wait": 6000},
+ {"click": [118, 716]},
+ {"wait": 2000},
+ {"shot": "tree"},
+ {"click": [99, 643]},
+ {"wait": 1000},
+ {"shot": "checked"},
+ {"hover": [140, 709]},
+ {"wait": 1200},
+ {"shot": "hover-loading"},
+ {"wait": 2500},
+ {"shot": "hover-resolved"},
+ {"dragShot": [140, 709, 140, 621], "shot": "drag"},
+ {"wait": 1500},
+ {"shot": "dropped"}
+]
diff --git a/port/ledger.md b/port/ledger.md
index 5f6a3cd0d12..12f1eddb1cb 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -93,7 +93,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| mainthread/MainThreadDocuments | MainThread* shape (Rust side) | M8 | verified | | host_sync.rs sends model opened, changed, dirty and saved; host_requests.rs answers $tryOpenDocument, $tryCreateDocument and $trySaveDocument with encodings, save participants, extension file system providers and casing, models kept 3 minutes after the host lets go: `vscode API - editors` 13/0/0, `vscode API - workspace` 84/2/0 (the 2 upstream skips) and `workspace events` 10/0/0 in the port/tools/api-tests whole folder suite without removed features and notebooks (port/results/api-tests.md, milestone 20 sweep); vscode://defaultsettings and vscode://schemas documents: port/tools/settings-check preferences; host_sync.rs sends model opened, changed, dirty and saved; host_requests.rs answers $tryOpenDocument (file and extension file system provider URIs) and $trySaveDocument, models kept 3 minutes after the host lets go: api-tests MOCHA_GREP="vscode API - editors" 13/0/0; $tryCreateDocument and untitled URIs with a path, save participants before $trySaveDocument: api-tests MOCHA_GREP="vscode API - workspace" 94/2/13; encodings (open with options.encoding, $resolveDecoding, $resolveEncoding): same grep 102/2/5; saves to extension file system providers ($save, $saveAll, save commands): same grep 105/2/2; casing opened first for case-insensitive providers: same grep 106/2/1; vscode://defaultsettings and vscode://schemas documents: port/tools/settings-check preferences |
| mainthread/MainThreadBulkEdits | MainThread* shape (Rust side) | M12 | verified | | file edits of workspace.applyEdit (api-tests: rename & ignoreIfExists, delete & ignoreIfNotExists, #111867 1/3 to 3/3, binary files pass); text edits and EOL changes through workbench/bulk_text_edits.rs, api-tests MOCHA_GREP="vscode API - workspace" 94/2/13 with every applyEdit test passing; cell edits go to the notebook models (api-tests notebook.document `workspace edit API` cases pass, milestone 17); an edit that needs confirmation waits in the Refactor Preview, `false` for no edits (port/resul [... omitted end of long line]; file edits of workspace.applyEdit (api-tests: rename & ignoreIfExists, delete & ignoreIfNotExists, #111867 1/3 to 3/3, binary files pass); text edits and EOL changes through workbench/bulk_text_edits.rs, api-tests MOCHA_GREP="vscode API - workspace" 94/2/13 with every applyEdit test passing; cell edits fail until milestone 13; an edit that needs confirmation waits in the Refactor Preview, `false` for no edits (port/results/refactor-preview.md) |
| mainthread/MainThreadTextEditors | MainThread* shape (Rust side) | M8 | verified | | notebook cells reach the host while a cell list template holds their model (rowCache.ts, listView.ts `render`; markup cells in edit mode): cargo test -p app the_host_sees_the_code_editors_of_the_rendered_cells cell_list_editors_follow_the_rendered_rows; options report the line numbers each editor draws (off in an output, a cell and zen mode) and send when they change: cargo test -p app set_options_apply_the_cursor_style_and_line_numbers; host_requests.rs answers $tryShowTextDocument, $tryShowEditor, $tryHideEditor (cargo test -p app text_editor_show_and_hide), $trySetSelections, $tryRevealRange, $trySetOptions, $tryApplyEdits, $tryInsertSnippet; `$acceptEditorDiffInformation` and `$getDiffInformation` from each visible text file's quick diffs and the diff editor's changes (workbench/editor_view/quick_diff.rs; cargo test -p app quick_diff_contributed); visible ranges and options reach the host: api-tests MOCHA_GREP="vscode API - editors" 13/0/0, window text editor tests without view columns pass; every selection and snippet range applies; view columns pick or add editor groups and `$acceptEditorPositionData` follows group changes since milestone 11; `_workbench.open` and `_workbench.diff` take their view column and read file system provider resources: api-tests `MOCHA_GREP="vscode API - window"` 40/0/0 since the notebook model (milestone 17), port/results/api-tests.md; host_requests.rs answers $tryShowTextDocument, $trySetSelections, $tryRevealRange, $trySetOptions, $tryApplyEdits, $tryInsertSnippet; visible ranges and options reach the host: api-tests MOCHA_GREP="vscode API - editors" 13/0/0, window text editor tests without view columns pass; every selection and snippet range applies; view columns pick or add editor groups and `$acceptEditorPositionData` follows group changes since milestone 11; `_workbench.open` and `_workbench.diff` take their view column and read file system provider resources: api-tests `MOCHA_GREP="vscode API - window"` 39/0/1, the failing one `openNotebookDocument` (milestone 17), port/results/api-tests.md |
-| mainthread/MainThreadTreeViews | MainThread* shape (Rust side) | M11 | ported | [3 L] tree_view.rs:262: tree item checkboxes (`checkboxState`, `$changeCheckboxState`), drag and drop (`$handleDrag`, `$handleDrop`) and `$resolve` (a tooltip resolved on hover) are not ported | workbench/tree_view.rs: $registerTreeViewDataProvider (showCollapseAll's Collapse All), $refresh, $reveal (parents, select, focus, expand levels), $setMessage (a string as text; a MarkdownString as paragraphs, its lone links as buttons with their `$(icon)`s, secondary after a button, disabled by the command's enablement), $setTitle, $setBadge, $disposeTree; `$getChildren`, `$setExpanded`, `$setSelectionAndFocus`, `$setVisible`, `onView:` activation; label highlights, `description: true` as the relative folder; views of every container (workbench/view_containers.rs); cargo test -p app tree_view custom_tree; ui-pair port/results/references-view.md; verified: api-tests `MOCHA_GREP="vscode API - window|vscode API - tree"`: api-folder 43 passing, 0 pending, 1 failing (`Tabs - Ensure tabs getter is correct`, openNotebookDocument: notebooks are milestone 17) (tree.test.ts all pass); ui-pair port/results/references-view.md (milestone 11 verification) |
+| mainthread/MainThreadTreeViews | MainThread* shape (Rust side) | M11 | verified | | workbench/tree_view.rs: $registerTreeViewDataProvider (showCollapseAll's Collapse All, canSelectMany, manuallyManageCheckboxes, the drag and drop mime types), tree item checkboxes (checkbox.ts `TreeItemCheckbox`, `setCascadingCheckboxUpdates` and `findCheckboxesUpdated` unless `manuallyManageCheckboxes`, `$changeCheckboxState`; cargo test -p app a_checkbox_click_sends_the_changed_states_and_selects_the_row a_checkbox_cascades_to_its_children_and_its_parent_follows_them), `$hasResolve` and `$resolve` (the hover's "Loading..." replaced by the resolved tooltip, a click resolving the command first; cargo test -p app an_item_resolves_its_tooltip_on_hover_and_its_command_on_click), drag and drop between rows (`CustomTreeViewDragAndDrop`: `$handleDrag` per operation, `$releaseDragOperation`, `$handleDrop` with the tree's own mime type and the drag's data; cargo test -p app a_row_dragged_onto_another_sends_handle_drag_then_handle_drop); ui-pair port/fixtures/extensions/ui-tree-checkbox.json with `ARGS=--extensionDevelopmentPath=<abs>/port/fixtures/extensions/tree-checkbox`: the boxes, the cascade, the hover's Loading... then Resolved Carrot and Carrot dropped under Fruits match the reference; $refresh, $reveal (parents, select, focus, expand levels), $setMessage (a string as text; a MarkdownString as paragraphs, its lone links as buttons with their `$(icon)`s, secondary after a button, disabled by the command's enablement), $setTitle, $setBadge, $disposeTree; `$getChildren`, `$setExpanded`, `$setSelectionAndFocus`, `$setVisible`, `onView:` activation; label highlights, `description: true` as the relative folder; views of every container (workbench/view_containers.rs); cargo test -p app tree_view custom_tree; ui-pair port/results/references-view.md; verified: api-tests `MOCHA_GREP="vscode API - window|vscode API - tree"`: api-folder 43 passing, 0 pending, 1 failing (`Tabs - Ensure tabs getter is correct`, openNotebookDocument: notebooks are milestone 17) (tree.test.ts all pass); ui-pair port/results/references-view.md (milestone 11 verification) |
| mainthread/MainThreadDownloadService | MainThread* shape (Rust side) | M18 | verified | | `_workbench.downloadResource` copies a file, fetches a URL and rejects a 404 with the upstream message: port/tools/extensions-check; session.rs answers undefined |
| mainthread/MainThreadErrors | MainThread* shape (Rust side) | M6 | verified | | main_thread_errors.rs: `$onUnexpectedError` goes through log.ts `createUnexpectedErrorHandler` (the stack, or `toErrorMessage`; the same text again within 1000 ms dropped) to the Window log; the session still prints it on stderr (cargo test -p app output::logger main_thread_errors: log.test.ts cases); session.rs writes `$onUnexpectedError` stacks to the port log (code-gpui stderr); seen in port/tools/api-tests api-folder.log |
| mainthread/MainThreadConsole | MainThread* shape (Rust side) | M6 | verified | | main_thread_errors.rs: `$logExtensionHostMessage` as remoteConsoleUtil.ts: `logRemoteEntryIfError` (errors, `[Extension Host]` label) in a normal window, `logRemoteEntry` (every entry, no label) in an extension test run, to the Window log; console.rs prints it on stderr as the reference main process does (cargo test -p app main_thread_errors; api-tests editors run: renderer.log carries the mocha lines); console.rs formats `$logExtensionHostMessage` like util.format to the port log; cargo test -p exthost console tests; mocha spec output in port/tools/api-tests logs |
@@ -218,7 +218,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| platform/globalKeybindings | src/vs/platform | M9 | verified | | system_wide_keybindings.rs GlobalShortcuts over Carbon RegisterEventHotKey (cargo test -p app system_wide: globalKeybindingsMainService.test.ts register, unregister on update, failed labels and retry, dedupe, trigger with and without args; Studio run: ctrl+alt+cmd+f19 with "systemWide": true opens the Command Palette while Finder stays frontmost, not with false); one window, so the multi-window routing and crashed-window tests do not apply; the process exit releases the hot keys (the shutdown case) |
| platform/gpu | src/vs/platform | | removed | | Artur: internal infrastructure or developer tool with no 1:1 counterpart in the native port |
| platform/history | src/vs/platform | M11 | verified | | contextScopedHistoryWidget.ts: `history.showPrevious`/`showNext` with `historyNavigationWidgetFocus` and the enablement keys on the find, replace, search, search editor and debug console inputs (cargo test -p app -- find_widget history); historyWidgetKeybindingHint.ts `showHistoryKeybindingHint` on the Search inputs' "(⇅ for history)" suffix (cargo test -p app -- history_hint: fails without it once Up is rebound); recently opened and File > Open Recent with Clear Recently Opened are platform/workspaces (cargo test -p app -- recently_opened menubar, port/results/open-recent.md) |
-| platform/hover | src/vs/platform | M9 | verified | | workbench/hover.rs: cargo test -p app hover (reference hover boxes; hoverService.test.ts pointer centering both ways, side re-evaluation right, left and above, capped-height fallbacks, tall side hover, empty content, pending hover cancelled by a click and by leaving, Alt lock and release; delay, instant, leave, click and key hide); `showAndFocusLastHover` focuses the hover's container and Escape there hides it (cargo test -p app the_accessible_view_reads_a_workbench_hover); `workbench.action.showHover` (`_showAndFocusHoverForActiveElement`) shows the focused item's hover focused: a managed hover (`ActionViewItem`) with `trapFocus`, Tab and Shift+Tab looping over the container and its markdown links (hoverWidget.ts `addFocusTrap`; Enter opens the focused link) and `lastFocusedElementBeforeOpen` focused again on Escape, a delayed hover (settingsWidgets.ts rows) without (cargo test -p app show_hover_focuses show_hover_on_a_focused_list a_folder_in_the_installation tab_loops_over_a_trap_focus_hovers_links); its targets are the items that take the focus in the port: the accessible view's toolbar, the timeline title toolbar, the banner's close button, the settings list rows and the status bar entry focused with statusbarActions.ts `workbench.statusBar.focusNext`/`focusPrevious`/`focusFirst`/`focusLast`/`clearFocus` (the focused entry's hover is the target the last frame painted inside it, workbench/hover.rs `painted_hover_within`; cargo test -p app the_status_bar_keys_move_an_entry_focus_with_its_hover); the activity bar's and its global bar's items, focused with actionbar.ts keys (workbench/action_bar.rs: Up/Down loop, Home/End, Enter and Space press, the hover painted inside the focused item; cargo test -p app the_activity_bar_items_take_the_keyboard_focus_with_their_hover); the panel and secondary side bar titles' three action bars (tabs, the merged view's actions, the global actions; Left/Right, Tab and Shift+Tab between them, Shift+Tab from the content, Tab on to it) and the panel tabs' hover with their open command's keybinding (compositeBarActions.ts `computeTitle`; cargo test -p app the_panel_title_bars_take_the_keyboard_focus_with_their_hover); pane header and merged view title actions, the tab stop between the header or title and the body (cargo test -p app the_pane_header_actions_are_a_tab_stop_with_their_hover a_merged_view_title_is_the_tab_stop_before_its_body); `persistence.sticky` (updateTitleBarEntry.ts' tooltip): locked, no key listener, Alt and other targets' hovers leave it, a press outside hides it (cargo test -p app a_sticky_hover_stays_until_a_press_outside_it); HTML content (languageStatus.ts `_combinedEntryTooltip`, updateTooltip.ts) does not hide on hover (cargo test -p app the_pointer_moves_onto_the_combined_entrys_html_hover); nested hovers (hoverService.ts `_hoverStack`, `MAX_HOVER_NESTING_DEPTH`) have no caller: no hover content in the port holds a workbench hover target (languageStatus.ts links and pin button and updateTooltip.ts' buttons take `nativeHoverDelegate` or `title`); markdown hovers (`IMarkdownString` with its `isTrusted`) render through `markdownRenderer` (workbench/markdown_view.rs `markdown_blocks`: bold, code, lists, headings, codicons, rules, untrusted `command:` links dropped to text) at most 500px wide, measured by a hidden first frame before `layout` places them, with the Tab-focused link outlined in `focusBorder` on each row it wraps to (cargo test -p app a_markdown_hover_wraps_at_the_max_width_and_is_placed_by_its_measured_size a_markdown_rule_collapses_its_margins tab_loops_over_a_trap_focus_hovers_links); screenshot pairs vs ref-hover dumps (port/results/hover.md); a panel tab's hover with its badge description (`computeTitle` appends `badge.getDescription()`: markers "Total {0} Problems", comments "{0} Unresolved Comments"; cargo test -p app a_panel_tab_hover_appends_the_badge_description); the side bar title's Views and More Actions... button of a container with several panes, the tab stop before the first pane header, Enter and Space open its Views submenu (cargo test -p app the_side_bar_title_more_actions_is_the_tab_stop_before_the_first_pane_header); the active editor tab (multiEditorTabsControl.ts, the group's only tab with `tabIndex = 0`): Shift+Tab from the editor in tab focus mode, Tab back, Left/Up and Right/Down open the neighbor without wrapping and Home/End the ends with `focusTabControl`, Enter and Space open the editor with the focus, a press leaves the focus where it is, its hover per group (cargo test -p app the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the update title bar entry (updateTitleBarEntry.ts, `MenuId.TitleBarUpdate`'s toolbar of its own): a tab stop with Shift+Tab from the activity bar and Tab back, Enter and Space run its action, `workbench.action.showHover` shows its sticky tooltip with the focus on its buttons (`focusTooltip`; cargo test -p app show_hover_on_the_update_title_bar_entry_focuses_its_tooltip); Shift+F10 on the focused tab shows its context menu below the tab (cargo test -p app the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the tabs' close actions (each tab's `ActionBar`, one tab stop per tab, inactive tabs too) and the group's editor actions toolbar (one tab stop, Left/Right/Home/End inside) in the DOM order between the active tab and the editor, Enter on a close action closes its tab (workbench/editor_status.rs `group_title_tab_stops`; cargo test -p app the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the main window's title bar toolbars in titlebarPart.ts' DOM order before the activity bar: the command center (`MenuId.CommandCenter` with the navigation buttons), the update entry and the action toolbar (editor actions, layout controls, the bell after them as `MenuId.TitleBar`'s trailing group, Manage, `...`), each one tab stop whose items run their command on Enter and Space (cargo test -p app the_title_bar_toolbars_are_tab_stops_in_the_dom_order show_hover_on_the_update_title_bar_entry_focuses_its_tooltip); F6 in an editor window focuses that window's status bar (ui-pair port/fixtures/ui-pair/editor-window-f6.json on the host lane: the port and the reference both outline the editor window's status bar); an editor window's title bar toolbars (compact mode, always on top, its editor actions) as tab stops of their own, Tab from them on to the editor part's active tab, Shift+Tab back, Enter running the item (cargo test -p app an_editor_windows_title_bar_toolbars_are_its_own_tab_stops) |
+| platform/hover | src/vs/platform | M9 | ported | [3 S] hover.rs:648: a plain text hover laid out at its measured width can wrap its last character: a resolving tree item's "Loading..." draws "Loading.." with the last dot on a second line below the box, where the reference fits it on one line (ui-pair port/fixtures/extensions/ui-tree-checkbox.json step hover-loading) | workbench/hover.rs: cargo test -p app hover (reference hover boxes; hoverService.test.ts pointer centering both ways, side re-evaluation right, left and above, capped-height fallbacks, tall side hover, empty content, pending hover cancelled by a click and by leaving, Alt lock and release; delay, instant, leave, click and key hide); `showAndFocusLastHover` focuses the hover's container and Escape there hides it (cargo test -p app the_accessible_view_reads_a_workbench_hover); `workbench.action.showHover` (`_showAndFocusHoverForActiveElement`) shows the focused item's hover focused: a managed hover (`ActionViewItem`) with `trapFocus`, Tab and Shift+Tab looping over the container and its markdown links (hoverWidget.ts `addFocusTrap`; Enter opens the focused link) and `lastFocusedElementBeforeOpen` focused again on Escape, a delayed hover (settingsWidgets.ts rows) without (cargo test -p app show_hover_focuses show_hover_on_a_focused_list a_folder_in_the_installation tab_loops_over_a_trap_focus_hovers_links); its targets are the items that take the focus in the port: the accessible view's toolbar, the timeline title toolbar, the banner's close button, the settings list rows and the status bar entry focused with statusbarActions.ts `workbench.statusBar.focusNext`/`focusPrevious`/`focusFirst`/`focusLast`/`clearFocus` (the focused entry's hover is the target the last frame painted inside it, workbench/hover.rs `painted_hover_within`; cargo test -p app the_status_bar_keys_move_an_entry_focus_with_its_hover); the activity bar's and its global bar's items, focused with actionbar.ts keys (workbench/action_bar.rs: Up/Down loop, Home/End, Enter and Space press, the hover painted inside the focused item; cargo test -p app the_activity_bar_items_take_the_keyboard_focus_with_their_hover); the panel and secondary side bar titles' three action bars (tabs, the merged view's actions, the global actions; Left/Right, Tab and Shift+Tab between them, Shift+Tab from the content, Tab on to it) and the panel tabs' hover with their open command's keybinding (compositeBarActions.ts `computeTitle`; cargo test -p app the_panel_title_bars_take_the_keyboard_focus_with_their_hover); pane header and merged view title actions, the tab stop between the header or title and the body (cargo test -p app the_pane_header_actions_are_a_tab_stop_with_their_hover a_merged_view_title_is_the_tab_stop_before_its_body); `persistence.sticky` (updateTitleBarEntry.ts' tooltip): locked, no key listener, Alt and other targets' hovers leave it, a press outside hides it (cargo test -p app a_sticky_hover_stays_until_a_press_outside_it); HTML content (languageStatus.ts `_combinedEntryTooltip`, updateTooltip.ts) does not hide on hover (cargo test -p app the_pointer_moves_onto_the_combined_entrys_html_hover); nested hovers (hoverService.ts `_hoverStack`, `MAX_HOVER_NESTING_DEPTH`) have no caller: no hover content in the port holds a workbench hover target (languageStatus.ts links and pin button and updateTooltip.ts' buttons take `nativeHoverDelegate` or `title`); markdown hovers (`IMarkdownString` with its `isTrusted`) render through `markdownRenderer` (workbench/markdown_view.rs `markdown_blocks`: bold, code, lists, headings, codicons, rules, untrusted `command:` links dropped to text) at most 500px wide, measured by a hidden first frame before `layout` places them, with the Tab-focused link outlined in `focusBorder` on each row it wraps to (cargo test -p app a_markdown_hover_wraps_at_the_max_width_and_is_placed_by_its_measured_size a_markdown_rule_collapses_its_margins tab_loops_over_a_trap_focus_hovers_links); screenshot pairs vs ref-hover dumps (port/results/hover.md); a panel tab's hover with its badge description (`computeTitle` appends `badge.getDescription()`: markers "Total {0} Problems", comments "{0} Unresolved Comments"; cargo test -p app a_panel_tab_hover_appends_the_badge_description); the side bar title's Views and More Actions... button of a container with several panes, the tab stop before the first pane header, Enter and Space open its Views submenu (cargo test -p app the_side_bar_title_more_actions_is_the_tab_stop_before_the_first_pane_header); the active editor tab (multiEditorTabsControl.ts, the group's only tab with `tabIndex = 0`): Shift+Tab from the editor in tab focus mode, Tab back, Left/Up and Right/Down open the neighbor without wrapping and Home/End the ends with `focusTabControl`, Enter and Space open the editor with the focus, a press leaves the focus where it is, its hover per group (cargo test -p app the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the update title bar entry (updateTitleBarEntry.ts, `MenuId.TitleBarUpdate`'s toolbar of its own): a tab stop with Shift+Tab from the activity bar and Tab back, Enter and Space run its action, `workbench.action.showHover` shows its sticky tooltip with the focus on its buttons (`focusTooltip`; cargo test -p app show_hover_on_the_update_title_bar_entry_focuses_its_tooltip); Shift+F10 on the focused tab shows its context menu below the tab (cargo test -p app the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the tabs' close actions (each tab's `ActionBar`, one tab stop per tab, inactive tabs too) and the group's editor actions toolbar (one tab stop, Left/Right/Home/End inside) in the DOM order between the active tab and the editor, Enter on a close action closes its tab (workbench/editor_status.rs `group_title_tab_stops`; cargo test -p app the_tab_close_actions_and_the_editor_actions_toolbar_are_tab_stops the_active_editor_tab_takes_the_keyboard_focus_with_its_hover); the main window's title bar toolbars in titlebarPart.ts' DOM order before the activity bar: the command center (`MenuId.CommandCenter` with the navigation buttons), the update entry and the action toolbar (editor actions, layout controls, the bell after them as `MenuId.TitleBar`'s trailing group, Manage, `...`), each one tab stop whose items run their command on Enter and Space (cargo test -p app the_title_bar_toolbars_are_tab_stops_in_the_dom_order show_hover_on_the_update_title_bar_entry_focuses_its_tooltip); F6 in an editor window focuses that window's status bar (ui-pair port/fixtures/ui-pair/editor-window-f6.json on the host lane: the port and the reference both outline the editor window's status bar); an editor window's title bar toolbars (compact mode, always on top, its editor actions) as tab stops of their own, Tab from them on to the editor part's active tab, Shift+Tab back, Enter running the item (cargo test -p app an_editor_windows_title_bar_toolbars_are_its_own_tab_stops) |
| platform/imageResize | src/vs/platform | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert |
| platform/instantiation | src/vs/platform | | removed | | Artur: internal infrastructure or developer tool with no 1:1 counterpart in the native port |
| platform/ipc | src/vs/platform | | n/a | | Electron process, IPC or DOM layer; replaced by the single-process Rust/GPUI architecture (port/notes.md) |