Visual Studio Code, rebuilt in Rust
Rust
fix(workbench): size list scrollbars as Modern UI does
rokarturaaacc152bcf1
diff --git a/native/crates/app/src/workbench/list_scroll.rs b/native/crates/app/src/workbench/list_scroll.rsindex 16f47966c34..06788ff4d5a 100644--- a/native/crates/app/src/workbench/list_scroll.rs+++ b/native/crates/app/src/workbench/list_scroll.rs@@ -24,8 +24,9 @@ use crate::list_tree::{SMOOTH_SCROLL_DURATION, paged_scroll_position, smooth_scr#[cfg(test)]mod tests;-/// listView.ts leaves `verticalScrollbarSize` and `horizontalScrollbarSize` at scrollableElement.ts's 10.-const SCROLLBAR_SIZE: f32 = 10.;+/// listView.ts and the DomScrollableElements leave `verticalScrollbarSize` and `horizontalScrollbarSize` at+/// scrollableElement.ts's global default, which modernUI.contribution.ts sets to `MODERN_UI_SCROLLBAR_SIZE`.+const SCROLLBAR_SIZE: f32 = 8.;/// roundedCorners.css: cornerRadius.small on every `.scrollbar > .slider` under Modern UI.pub(super) const SLIDER_RADIUS: f32 = 4.;/// scrollableElement.ts `HIDE_TIMEOUT`.@@ -261,8 +262,6 @@ impl Workbench {// multiEditorTabsControl.ts `createTabsScrollbar`: `vertical: Hidden`, `getTabsScrollbarSizing` 3 or 10.ListId::EditorTabs { .. } => (0., if self.setting("workbench.editor.titleScrollbarSizing") == json!("large") { 10. } else { 3. }),ListId::MarkerMessage => (6., 6.),- // scrollableElement.ts global default, set by modernUI.contribution.ts `MODERN_UI_SCROLLBAR_SIZE`.- ListId::ParameterHints | ListId::Page(_) | ListId::MultiDiff(_) => (8., 0.),_ => (SCROLLBAR_SIZE, if self.horizontal_scrolling(list) { SCROLLBAR_SIZE } else { 0. }),}}diff --git a/native/crates/app/src/workbench/list_scroll/tests.rs b/native/crates/app/src/workbench/list_scroll/tests.rsindex c5f3c227c4c..41c98536af1 100644--- a/native/crates/app/src/workbench/list_scroll/tests.rs+++ b/native/crates/app/src/workbench/list_scroll/tests.rs@@ -167,6 +167,20 @@ fn the_explorer_paints_only_the_rows_in_view(cx: &mut TestAppContext) {std::fs::remove_dir_all(dir).unwrap();}+/// modernUI.contribution.ts sets scrollableElement.ts's default to 8px; listView.ts and pages keep it, the editor+/// tabs and the marker message set their own.+#[gpui::test]+fn lists_and_pages_take_the_modern_ui_scrollbar_size(cx: &mut TestAppContext) {+ let (dir, workbench, cx) = explorer("sizes", cx);+ workbench.read_with(cx, |workbench, _| {+ assert_eq!(workbench.scrollbar_sizes(ListId::Explorer), (8., 0.));+ assert_eq!(workbench.scrollbar_sizes(ListId::Scrollable("problems-tree")), (8., 0.));+ assert_eq!(workbench.scrollbar_sizes(ListId::Page("walkthrough-playground")), (8., 0.));+ assert_eq!(workbench.scrollbar_sizes(ListId::MarkerMessage), (6., 6.));+ });+ std::fs::remove_dir_all(dir).unwrap();+}+/// markersView.ts puts the Problems tree in a ScrollableElement: the wheel scrolls it and the pointer over it/// shows its scrollbar (`Workbench::scrollable`).#[gpui::test]