Visual Studio Code, rebuilt in Rust
Rust
//! Extension status bar entries (statusbarItem.ts): `$(icon)` labels, colors, tooltip and command.
use std::collections::HashSet;
use std::time::Duration;
use gpui::prelude::FluentBuilder;
use gpui::{Animation, AnimationExt, AnyElement, BorderStyle, Bounds, Context, Div, Stateful, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Rgba, StatefulInteractiveElement, Styled, Transformation, Window, canvas, div, outline, percentage, point, px, svg};
use serde_json::{Value, json};
use super::Workbench;
use super::hover::{HoverContent, HoverOptions};
use crate::commands::Outcome;
use crate::menus::MenuAction;
use crate::main_thread_status_bar::StatusEntry;
use crate::theme::parse_hex;
/// markers.contribution.ts: `status.problems` sits at priority 50 on the left.
pub(super) const PROBLEMS_PRIORITY: f64 = 50.;
/// editorStatus.ts: the editor entries sit at 100.1 (language) to 100.8 on the right; extension entries in between
/// go before all of them.
pub(super) const EDITOR_STATUS_PRIORITY: f64 = 100.1;
/// statusbarModel.ts `HIDDEN_ENTRIES_KEY`, in profile storage.
const HIDDEN_ENTRIES_KEY: &str = "workbench.statusbar.hidden";
const TOGGLE_ENTRY_PREFIX: &str = "workbench.statusBar.toggleEntry.";
const HIDE_ENTRY_PREFIX: &str = "workbench.statusBar.hideEntry.";
/// statusbarActions.ts `ManageExtensionAction`, one command per extension.
const MANAGE_EXTENSION_PREFIX: &str = "statusbar.manage.extension.";
const STATUS_ITEM_GROUP: &str = "status-item";
/// An entry the status bar drew or hid: statusbarModel.ts's `id`, `name` and `extensionId`.
#[derive(Clone, Debug, PartialEq)]
pub(super) struct DrawnStatusEntry {
pub(super) id: String,
pub(super) name: String,
pub(super) extension_id: Option<String>,
}
impl Workbench {
/// The entries of one side whose priority `keep` accepts, in statusbarModel.ts order.
pub(super) fn extension_status_items(&self, left: bool, keep: impl Fn(f64) -> bool, foreground: Rgba, cx: &mut Context<Self>) -> Vec<(bool, AnyElement)> {
let entries = self.status_entries.iter().filter(|entry| entry.align_left == left && keep(entry.priority));
entries.filter_map(|entry| self.status_bar_extension_entry(entry, foreground, cx)).collect()
}
/// One status bar side: statusbarPart.ts `updateVisibleBackgroundColorNeighbors` puts 4px (2px in compact density)
/// between two adjacent drawn entries with backgrounds.
pub(super) fn status_bar_side(&self, items: Vec<(bool, AnyElement)>) -> Div {
let gap = if self.compact_density() { 2. } else { 4. };
let mut side = div().h_full().flex();
let mut previous_background = false;
for (background, item) in items {
if background && previous_background {
side = side.child(div().w(px(gap)).flex_none());
}
side = side.child(item);
previous_background = background;
}
side
}
pub(super) fn extension_status_item(&self, entry: &StatusEntry, first_visible: bool, foreground: Rgba, cx: &mut Context<Self>) -> Stateful<Div> {
let own_color = entry.kind.is_none().then(|| entry.color.as_ref().and_then(|color| self.entry_color(color))).flatten();
let (color, background) = match entry.kind {
Some(kind) => (self.color(&format!("statusBarItem.{kind}Foreground")), self.theme.color(&format!("statusBarItem.{kind}Background"))),
None => (own_color.unwrap_or(foreground), entry.background_color.as_ref().and_then(|color| self.entry_color(color))),
};
// statusbarItem.ts `applyColor`: an own color is the label's inline style, above statusbarpart.css's `a:hover` color.
let hover = own_color.is_none().then(|| self.color(&status_item_hover_key(entry.kind, "Foreground")));
let mut label = self.status_entry_label(&entry.text, color, hover);
if entry.show_progress {
// statusbarItem.ts: a non-breaking space between the spinner and the text.
label = self.status_entry_label(&format!("\u{a0}{}", entry.text), color, hover);
// codicon-animations.css: `codicon-modifier-spin` turns once in 1.5s in 30 steps.
let path = self.app_root.join("node_modules/@vscode/codicons/src/icons/loading.svg");
let spinner = svg()
.external_path(path.to_string_lossy().into_owned())
.size(px(16.))
.flex_none()
.text_color(color)
.when_some(hover, |spinner, hover| spinner.group_hover(STATUS_ITEM_GROUP, move |spinner| spinner.text_color(hover)))
.with_animation("status-progress-spin", Animation::new(Duration::from_millis(1500)).repeat(), |spinner, delta| {
spinner.with_transformation(Transformation::rotate(percentage((delta * 30.).floor() / 30.)))
});
label = div().flex().items_center().child(spinner).child(label);
}
let label = label.when_some(own_color, |label, color| label.text_color(color));
let command = entry.command.clone();
let (margin, padding) = self.status_label_spacing(has_background(entry), first_visible);
let item = div()
.id(gpui::SharedString::from(format!("status-entry-{}", entry.entry_id)))
.relative()
.h_full()
.flex_none()
.mx(px(margin))
.px(px(padding))
.flex()
.items_center()
.whitespace_nowrap()
.text_color(color)
.when_some(background, |item, background| item.bg(background))
.when(command.is_some(), |item| self.status_item_hover(item.cursor_pointer(), entry.kind))
.child(label)
.when_some(entry.tooltip.clone(), |item, tooltip| item.child(self.hover_target(format!("status-entry-hover-{}", entry.entry_id), HoverContent::Text(tooltip), HoverOptions::status_bar())))
.on_click(cx.listener(move |workbench, _, window, cx| {
let Some(command) = &command else { return };
let (id, args) = match command {
Value::String(id) => (id.clone(), Vec::new()),
command => (command["id"].as_str().unwrap_or_default().to_owned(), command["arguments"].as_array().cloned().unwrap_or_default()),
};
let outcome = workbench.execute_command(&id, args, window, cx);
super::quick_access::show_failure(id, outcome, window, cx);
}));
item
}
/// statusbarpart.css `.statusbar-item a:hover:not(.disabled)`: the label of an entry with a command takes its kind's
/// hover colors, in modernUI statusBar.css's cornerRadius.small (4px), and in high contrast a 1px dashed
/// `contrastActiveBorder` outline inside it.
pub(super) fn status_item_hover(&self, item: Stateful<Div>, kind: Option<&str>) -> Stateful<Div> {
let (background, foreground) = (self.color(&status_item_hover_key(kind, "Background")), self.color(&status_item_hover_key(kind, "Foreground")));
let outline = self.theme.color("contrastActiveBorder").map(|border| {
div().absolute().inset_0().rounded(px(4.)).border_1().border_dashed().border_color(border).invisible().group_hover(STATUS_ITEM_GROUP, |outline| outline.visible())
});
item.group(STATUS_ITEM_GROUP).rounded(px(4.)).hover(move |item| item.bg(background).text_color(foreground)).children(outline)
}
/// statusbarpart.css `span.codicon { color: inherit }`: an icon of a `status_item_hover` label takes the hovered
/// label's `statusBarItem.hoverForeground`.
pub(super) fn status_item_icon(&self, name: &str, box_size: f32, foreground: Rgba) -> Div {
let hover = self.color("statusBarItem.hoverForeground");
self.styled_icon(name, box_size, 16., |icon| icon.text_color(foreground).group_hover(STATUS_ITEM_GROUP, move |icon| icon.text_color(hover)))
}
/// statusbarItem.ts `StatusBarCodiconLabel`: the `$(icon)`s are `span.codicon`s, `color: inherit` of the label
/// (statusbarpart.css), so they take the `hover` foreground with its text.
fn status_entry_label(&self, text: &str, color: Rgba, hover: Option<Rgba>) -> Div {
let chars: Vec<char> = text.chars().collect();
let mut label = div().flex().items_center().min_w_0();
let mut segment = String::new();
let mut index = 0;
while index < chars.len() {
let Some((name, length)) = super::quick_input_view::icon_at(&chars[index..]) else {
segment.push(chars[index]);
index += 1;
continue;
};
if !segment.is_empty() {
label = label.child(std::mem::take(&mut segment));
}
label = label.child(self.styled_icon(&name, 16., 16., |icon| icon.text_color(color).when_some(hover, |icon, hover| icon.group_hover(STATUS_ITEM_GROUP, move |icon| icon.text_color(hover)))));
index += length;
}
if !segment.is_empty() {
label = label.child(segment);
}
label
}
pub(super) fn status_bar_extension_entry(&self, entry: &StatusEntry, foreground: Rgba, cx: &mut Context<Self>) -> Option<(bool, AnyElement)> {
let item = self.extension_status_item(entry, false, foreground, cx);
self.status_bar_entry(&entry.id, &entry.name, entry.extension_id.as_deref(), has_background(entry), item, cx)
}
/// statusbarModel.ts: the entry is listed in the context menu, not drawn while hidden, and its right click shows the
/// menu with Hide. Returns whether it paints a background (`has-background-color`) with the element.
pub(super) fn status_bar_entry(&self, id: &str, name: &str, extension_id: Option<&str>, background: bool, element: impl IntoElement, cx: &mut Context<Self>) -> Option<(bool, AnyElement)> {
let entry = DrawnStatusEntry { id: id.to_owned(), name: name.to_owned(), extension_id: extension_id.map(str::to_owned) };
self.drawn_status_entries.borrow_mut().push(entry.clone());
if self.hidden_status_entries().iter().any(|hidden| hidden == id) {
return None;
}
let selector = format!("status-bar-entry-{id}");
let drawn = self.status_entry_bounds.clone();
let drawn_id = id.to_owned();
let focus = self.status_entry_focus.clone();
let focus_id = id.to_owned();
let status_bar_focus = self.status_bar_focus.clone();
let label_left = px(self.status_label_spacing(background, false).0);
let border = self.theme.color("focusBorder");
let item = div()
.debug_selector(move || selector)
.relative()
.h_full()
.flex_none()
.flex()
.on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| {
cx.stop_propagation();
workbench.show_status_bar_context_menu(Some(&entry), event.position, window, cx);
}))
.child(element)
// workbench.css: the focused label's 1px `focusBorder` outline, inside it.
.child(canvas(move |bounds, window, _| drawn.borrow_mut().push((window.window_handle().window_id(), drawn_id, bounds)), move |bounds, _, window, _| {
let focused = focus.get(&window.window_handle().window_id()).is_some_and(|focused| *focused == focus_id);
if let Some(border) = border.filter(|_| focused && status_bar_focus.is_focused(window)) {
let label = Bounds::from_corners(point(bounds.left() + label_left, bounds.top()), bounds.bottom_right());
window.paint_quad(outline(label, border, BorderStyle::Solid));
}
}).absolute().size_full());
Some((background, item.into_any_element()))
}
/// statusbarPart.ts `getContextMenuActions`: Hide Status Bar, one toggle per entry id, then for the entry under the
/// mouse Manage Extension and Hide.
pub(super) fn show_status_bar_context_menu(&mut self, under_mouse: Option<&DrawnStatusEntry>, position: Point<Pixels>, window: &mut Window, cx: &mut Context<Self>) {
let command = |id: String, title: String, checked: bool| MenuAction::Command { id, title, enabled: true, checked, alt: None };
let mut actions = vec![command("workbench.action.toggleStatusbarVisibility".into(), "Hide Status Bar".into(), false), MenuAction::Separator];
let hidden = self.hidden_status_entries();
let drawn = self.drawn_status_entries.borrow().clone();
let mut handled = HashSet::new();
for entry in drawn {
if !handled.insert(entry.id.clone()) {
continue;
}
let toggle = format!("{TOGGLE_ENTRY_PREFIX}{}", entry.id);
let id = entry.id.clone();
self.register_status_entry_command(&toggle, move |workbench, cx| {
let hidden = workbench.hidden_status_entries().contains(&id);
workbench.set_status_entry_hidden(&id, !hidden, cx);
});
actions.push(command(toggle, entry.name, !hidden.contains(&entry.id)));
}
if let Some(entry) = under_mouse {
actions.push(MenuAction::Separator);
if let Some(extension_id) = entry.extension_id.clone() {
let manage = format!("{MANAGE_EXTENSION_PREFIX}{extension_id}");
if self.commands.get(&manage).is_none() {
self.commands.register(manage.clone(), move |workbench, _, window, cx| workbench.execute_command("_extensions.manage", vec![json!(extension_id)], window, cx));
}
actions.push(command(manage, "Manage Extension".into(), false));
}
let hide = format!("{HIDE_ENTRY_PREFIX}{}", entry.id);
let id = entry.id.clone();
self.register_status_entry_command(&hide, move |workbench, cx| workbench.set_status_entry_hidden(&id, true, cx));
actions.push(command(hide, format!("Hide '{}'", entry.name), false));
}
let context = self.key_context(window);
self.show_context_menu_actions(actions, &context, Bounds::new(position, Default::default()), Vec::new(), window, cx);
}
pub(super) fn register_status_bar_focus_commands(&mut self) {
self.commands.register("workbench.statusBar.focusPrevious", |workbench, _, window, cx| workbench.focus_status_entry(-1, window, cx));
self.commands.register("workbench.statusBar.focusNext", |workbench, _, window, cx| workbench.focus_status_entry(1, window, cx));
self.commands.register("workbench.statusBar.focusFirst", |workbench, _, window, cx| {
workbench.status_entry_focus.remove(&window.window_handle().window_id());
workbench.focus_status_entry(1, window, cx)
});
self.commands.register("workbench.statusBar.focusLast", |workbench, _, window, cx| {
workbench.status_entry_focus.remove(&window.window_handle().window_id());
workbench.focus_status_entry(-1, window, cx)
});
// statusbarActions.ts `workbench.statusBar.clearFocus`: Escape leaves the entry for the bar, then the bar for the editor.
self.commands.register("workbench.statusBar.clearFocus", |workbench, _, window, cx| {
if workbench.status_entry_focus.remove(&window.window_handle().window_id()).is_none() {
window.focus(&workbench.editor_focus, cx);
}
cx.notify();
Outcome::done()
});
}
/// statusbarModel.ts `focusNextEntry` and `focusPreviousEntry`: the drawn entry beside the focused one, past the
/// last or before the first the first or the last, in the window's own status bar.
fn focus_status_entry(&mut self, delta: isize, window: &Window, cx: &mut Context<Self>) -> Outcome {
let window_id = window.window_handle().window_id();
let entries: Vec<String> = self.status_entry_bounds.borrow().iter().filter(|(drawn_in, ..)| *drawn_in == window_id).map(|(_, id, _)| id.clone()).collect();
let current = self.status_entry_focus.get(&window_id).and_then(|focused| entries.iter().position(|id| id == focused));
let restart = if delta > 0 { 0 } else { entries.len().wrapping_sub(1) };
let next = current.and_then(|index| index.checked_add_signed(delta)).filter(|&index| index < entries.len()).unwrap_or(restart);
match entries.get(next) {
Some(entry) => self.status_entry_focus.insert(window_id, entry.clone()),
None => self.status_entry_focus.remove(&window_id),
};
cx.notify();
Outcome::done()
}
/// The focused entry's bounds as last drawn, while the status bar has the focus.
pub(super) fn focused_status_entry_bounds(&self, window: &Window) -> Option<Bounds<Pixels>> {
let window_id = window.window_handle().window_id();
let focused = self.status_entry_focus.get(&window_id).filter(|_| self.status_bar_focus.is_focused(window))?;
self.status_entry_bounds.borrow().iter().find(|(drawn_in, id, _)| *drawn_in == window_id && id == focused).map(|(.., bounds)| *bounds)
}
fn register_status_entry_command(&mut self, command: &str, run: impl Fn(&mut Self, &mut Context<Self>) + 'static) {
if self.commands.get(command).is_none() {
self.commands.register(command.to_owned(), move |workbench, _, _, cx| {
run(workbench, cx);
Outcome::done()
});
}
}
pub(super) fn hidden_status_entries(&self) -> Vec<String> {
let storage = self.profile_storage.lock().unwrap();
storage.get(HIDDEN_ENTRIES_KEY).and_then(|stored| serde_json::from_str(stored).ok()).unwrap_or_default()
}
/// statusbarModel.ts `hide` and `show`; with no entry hidden the key is removed.
fn set_status_entry_hidden(&mut self, id: &str, hidden: bool, cx: &mut Context<Self>) {
let mut entries = self.hidden_status_entries();
entries.retain(|entry| entry != id);
if hidden {
entries.push(id.to_owned());
}
let mut storage = self.profile_storage.lock().unwrap();
match entries.is_empty() {
true => storage.delete(HIDDEN_ENTRIES_KEY),
false => storage.set(HIDDEN_ENTRIES_KEY, json!(entries).to_string()),
}
drop(storage);
cx.notify();
}
/// A string `#rrggbb` color or a `ThemeColor` `{ id }`.
fn entry_color(&self, color: &Value) -> Option<Rgba> {
match color {
Value::String(hex) => parse_hex(hex),
color => self.theme.color(color["id"].as_str()?),
}
}
}
/// statusbarItem.ts: `has-background-color` for an own background or a kind other than standard.
pub(super) fn has_background(entry: &StatusEntry) -> bool {
entry.background_color.is_some() || entry.kind.is_some()
}
fn status_item_hover_key(kind: Option<&str>, part: &str) -> String {
match kind {
Some(kind) => format!("statusBarItem.{kind}Hover{part}"),
None => format!("statusBarItem.hover{part}"),
}
}
/// The name of an editor status entry (editorStatus.ts, editorStatusBar.ts, mediaPreviewStatusBar.ts).
pub(super) fn editor_status_entry_name(id: &str) -> &'static str {
match id {
"status.editor.columnSelectionMode" => "Column Selection Mode",
"status.editor.tabFocusMode" => "Accessibility Mode",
"status.editor.inputMode" => "Enable Insert Mode",
"status.editor.selection" => "Editor Selection",
"status.editor.indentation" => "Editor Indentation",
"status.editor.encoding" => "Editor Encoding",
"status.editor.eol" => "Editor End of Line",
"status.editor.mode" => "Editor Language",
"status.editor.info" => "File Information",
"notebook.status.indentation" => "Notebook Indentation",
"notebook.activeCellStatus" => "Notebook Editor Selections",
"status.imagePreview.zoom" => "Image Zoom",
"status.imagePreview.dimensions" => "Image Dimensions",
"status.mediaPreview.fileSize" => "Media File Size",
id => panic!("no editor status entry {id}"),
}
}
#[cfg(test)]
mod tests {
use std::path::Path;
use exthost::scan::scan_extension;
use gpui::{Modifiers, MouseButton, TestAppContext, VisualTestContext};
use crate::host_sync::HostSync;
use crate::languages::Languages;
use crate::main_thread_status_bar::StatusEntry;
use crate::menus::MenuAction;
use crate::theme::load_theme;
use crate::workbench::Workbench;
fn right_click(workbench: &gpui::Entity<Workbench>, selector: &'static str, cx: &mut VisualTestContext) -> Vec<(String, String, bool)> {
cx.update(|window, cx| drop(window.draw(cx)));
let position = cx.debug_bounds(selector).expect("the clicked element").center();
cx.simulate_mouse_down(position, MouseButton::Right, Modifiers::none());
cx.simulate_mouse_up(position, MouseButton::Right, Modifiers::none());
cx.run_until_parked();
let items = workbench.read_with(cx, |workbench, _| {
let menu = workbench.context_menu.as_ref().expect("a context menu shows");
menu.levels[0].actions.iter().map(|action| match action {
MenuAction::Command { id, title, checked, .. } => (id.clone(), title.clone(), *checked),
_ => (String::new(), "---".into(), false),
}).collect()
});
cx.simulate_keystrokes("escape");
items
}
fn run(workbench: &gpui::Entity<Workbench>, command: &str, cx: &mut VisualTestContext) {
workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command(command, Vec::new(), window, cx)));
cx.update(|window, cx| drop(window.draw(cx)));
}
/// statusbarPart.ts `getContextMenuActions` on an extension entry, its Hide, and the toggle that shows it again
/// (statusbarModel.ts `workbench.statusbar.hidden`).
#[gpui::test]
fn the_status_bar_context_menu_hides_an_entry_and_shows_it_again(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let (workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.status_entries.push(StatusEntry {
entry_id: "1".into(),
extension_id: Some("pub.ext".into()),
id: "pub.ext.entry".into(),
name: "My Entry".into(),
text: "Mine".into(),
tooltip: None,
command: None,
color: None,
background_color: None,
kind: None,
align_left: true,
priority: 10.,
secondary: 0,
show_progress: false,
});
workbench
});
cx.run_until_parked();
let item = |id: &str, title: &str, checked: bool| (id.to_owned(), title.to_owned(), checked);
let separator = item("", "---", false);
let toggles = |shown: bool| vec![item("workbench.statusBar.toggleEntry.status.problems", "Problems", true), item("workbench.statusBar.toggleEntry.pub.ext.entry", "My Entry", shown), item("workbench.statusBar.toggleEntry.status.notifications", "Notifications", true)];
let menu = right_click(&workbench, "status-bar-entry-pub.ext.entry", cx);
let on_entry = [item("workbench.action.toggleStatusbarVisibility", "Hide Status Bar", false), separator.clone()].into_iter().chain(toggles(true)).chain([separator.clone(), item("statusbar.manage.extension.pub.ext", "Manage Extension", false), item("workbench.statusBar.hideEntry.pub.ext.entry", "Hide 'My Entry'", false)]);
assert_eq!(menu, on_entry.collect::<Vec<_>>());
run(&workbench, "workbench.statusBar.hideEntry.pub.ext.entry", cx);
assert!(cx.debug_bounds("status-bar-entry-pub.ext.entry").is_none(), "a hidden entry is not drawn");
let stored = workbench.read_with(cx, |workbench, _| workbench.profile_storage.lock().unwrap().get("workbench.statusbar.hidden").map(str::to_owned));
assert_eq!(stored.as_deref(), Some(r#"["pub.ext.entry"]"#));
let on_problems = [item("workbench.action.toggleStatusbarVisibility", "Hide Status Bar", false), separator.clone()].into_iter().chain(toggles(false)).chain([separator, item("workbench.statusBar.hideEntry.status.problems", "Hide 'Problems'", false)]);
assert_eq!(right_click(&workbench, "status-bar-entry-status.problems", cx), on_problems.collect::<Vec<_>>());
run(&workbench, "workbench.statusBar.toggleEntry.pub.ext.entry", cx);
assert!(cx.debug_bounds("status-bar-entry-pub.ext.entry").is_some());
let stored = workbench.read_with(cx, |workbench, _| workbench.profile_storage.lock().unwrap().get("workbench.statusbar.hidden").map(str::to_owned));
assert_eq!(stored, None, "showing the last hidden entry removes the key");
}
/// statusbarPart.ts `updateVisibleBackgroundColorNeighbors`: modernUI statusBar.css's 4px between two adjacent
/// entries with backgrounds, none after a plain one.
#[gpui::test]
fn adjacent_entries_with_backgrounds_get_a_gap(cx: &mut TestAppContext) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
let entry = |id: &str, kind, priority| StatusEntry {
entry_id: id.into(),
extension_id: Some("pub.ext".into()),
id: id.into(),
name: id.into(),
text: id.into(),
tooltip: None,
command: None,
color: None,
background_color: None,
kind,
align_left: true,
priority,
secondary: 0,
show_progress: false,
};
let (_workbench, cx) = cx.add_window_view(|_, cx| {
let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);
workbench.status_entries.extend([entry("warning", Some("warning"), 9.), entry("error", Some("error"), 8.), entry("plain", None, 7.)]);
workbench
});
cx.run_until_parked();
cx.update(|window, cx| drop(window.draw(cx)));
let warning = cx.debug_bounds("status-bar-entry-warning").expect("the entry is drawn");
let error = cx.debug_bounds("status-bar-entry-error").expect("the entry is drawn");
let plain = cx.debug_bounds("status-bar-entry-plain").expect("the entry is drawn");
assert_eq!(error.left() - warning.right(), gpui::px(4.));
assert_eq!(plain.left() - error.right(), gpui::px(0.));
}
}