Compare commits

...
3 Commits
Author SHA1 Message Date
swaitsandClaude Fable 5.2 e3b56cb213 Never start sccache unless asked; compact reasons panel
A server started from the dashboard has the dashboard's environment, not
the builds'. It came up with the 10 GB default beside a 250 GB cache and
sccache trimmed the cache. Starting is now opt-in
(SCCACHE_DASH_START_SCCACHE=1) and the README says why.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 18:32:20 -07:00
swaitsandClaude Fable 5.2 c2b07734c6 Merge compact reasons panel: one line per reason, click to open
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 18:26:16 -07:00
swaitsandClaude Sonnet 5.5 30643390a7 Reasons: one line each, click to open; stack the small panels beside tall reasons
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-28 18:23:28 -07:00
7 changed files with 253 additions and 45 deletions

No files matched your search

+8 -2
View File
@@ -74,8 +74,14 @@ reading ever is a baseline and counts for nothing.
## Notes on sccache ## Notes on sccache
When no sccache server is running, sccache-dash starts one (`sccache --start-server`); if that sccache-dash never starts or stops sccache's server by itself. When none is running it shows
fails it shows "not running" with the error and tries again a minute later. "not running"; sccache starts its own server on your next build, with your build's settings.
To have sccache-dash start the server when none is running, set `SCCACHE_DASH_START_SCCACHE=1`
in its environment. Be careful with this: a server started that way gets sccache-dash's
environment, not your build's. If your cache size or folder is set only in your build's
environment, the server comes up with sccache's defaults, and sccache deletes cache entries
until the cache fits the 10 GB default.
While sccache-dash runs, sccache's server stays up: being asked for its stats every 10 seconds While sccache-dash runs, sccache's server stays up: being asked for its stats every 10 seconds
keeps it from shutting itself down after 10 idle minutes. keeps it from shutting itself down after 10 idle minutes.
+12 -2
View File
@@ -34,10 +34,16 @@ pub struct Config {
pub sccache: OsString, pub sccache: OsString,
/// The SQLite file the history is saved in. /// The SQLite file the history is saved in.
pub history: PathBuf, pub history: PathBuf,
/// Whether to start sccache's server when none is listening. Off unless asked for: a
/// server started from here has this program's environment, not the builds', so it can
/// come up with another cache size or folder, and sccache trims the cache to the size
/// it is started with.
pub start_sccache: bool,
} }
impl Config { impl Config {
/// `SCCACHE_DASH_SCCACHE` names the sccache command (`sccache` when unset); the history /// `SCCACHE_DASH_SCCACHE` names the sccache command (`sccache` when unset);
/// `SCCACHE_DASH_START_SCCACHE=1` lets it start sccache's server; the history
/// lives in `$XDG_DATA_HOME/sccache-dash/history.db`. /// lives in `$XDG_DATA_HOME/sccache-dash/history.db`.
pub fn from_env() -> Result<Config, String> { pub fn from_env() -> Result<Config, String> {
let sccache = std::env::var_os("SCCACHE_DASH_SCCACHE").unwrap_or_else(|| "sccache".into()); let sccache = std::env::var_os("SCCACHE_DASH_SCCACHE").unwrap_or_else(|| "sccache".into());
@@ -46,6 +52,7 @@ impl Config {
Ok(Config { Ok(Config {
sccache, sccache,
history: dir.join("sccache-dash").join("history.db"), history: dir.join("sccache-dash").join("history.db"),
start_sccache: std::env::var_os("SCCACHE_DASH_START_SCCACHE").is_some_and(|v| v == "1"),
}) })
} }
} }
@@ -299,9 +306,12 @@ impl Task {
} }
} }
/// Starts sccache's server when none is listening, at most once a minute. `Err` says why /// Starts sccache's server when none is listening and that was asked for, at most once a minute. `Err` says why
/// there is none, including when an earlier attempt is still being waited out. /// there is none, including when an earlier attempt is still being waited out.
fn start_server(&mut self, app: &App, now: i64) -> Result<(), String> { fn start_server(&mut self, app: &App, now: i64) -> Result<(), String> {
if !app.cfg.start_sccache {
return Err("no sccache server is running; your next build starts it".to_owned());
}
if let Some(when) = self.started_at { if let Some(when) = self.started_at {
if now - when < START_EVERY { if now - when < START_EVERY {
return Err(self return Err(self
+25
View File
@@ -91,6 +91,7 @@ esac
Config { Config {
sccache: self.script.clone().into(), sccache: self.script.clone().into(),
history: self.history.clone(), history: self.history.clone(),
start_sccache: true,
} }
} }
} }
@@ -444,6 +445,30 @@ fn old_rows_are_deleted_at_startup() {
); );
} }
#[test]
fn a_missing_sccache_server_is_left_alone_unless_starting_was_asked_for() {
let fake = Fake::new();
fake.down();
let app = App::with_probe(
Config {
start_sccache: false,
..fake.config()
},
fake.probe(),
);
let mut task = Task::memory();
task.poll(&app, NOW);
task.poll(&app, NOW + 120);
let calls = fake.calls();
assert!(!calls.iter().any(|c| c == "--start-server"), "{calls:?}");
assert!(app
.lock()
.error
.as_deref()
.is_some_and(|e| e.contains("your next build starts it")));
}
#[test] #[test]
fn a_missing_sccache_server_is_started_once_then_read() { fn a_missing_sccache_server_is_started_once_then_read() {
let fake = Fake::new(); let fake = Fake::new();
+26 -3
View File
@@ -5,6 +5,7 @@ use std::time::Duration;
use eframe::egui; use eframe::egui;
use sccache_dash_api::{Range, View}; use sccache_dash_api::{Range, View};
use crate::disclosure;
use crate::fmt; use crate::fmt;
use crate::theme; use crate::theme;
use crate::{cards, extras, net, overtime, problems, raw, speed, style, where_went}; use crate::{cards, extras, net, overtime, problems, raw, speed, style, where_went};
@@ -631,18 +632,40 @@ fn page(ui: &mut egui::Ui, view: &View, asked: Range, hidden_languages: &mut Vec
2 => { 2 => {
let half = style::span_width(ui, 2, 1); let half = style::span_width(ui, 2, 1);
let reasons = where_went::reasons_height(ui, view, half); let reasons = where_went::reasons_height(ui, view, half);
let (where_h, languages_h) = (
l::TRIPTYCH_HEIGHT.max(l::WHERE_FIXED_HEIGHT),
table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()),
);
let problems_h = problems_height(ui, view, half);
// Stacked, "By language" is its own row, so it also holds its head line.
let languages_h = languages_h.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len() + 1));
let stacked = where_h + languages_h + problems_h + 2.0 * gap;
if disclosure::stack_beside(where_h, stacked, reasons) {
// The reasons are tall: the three small panels stack beside them, the last one filling what is left.
let [left, right] = row(ui, stacked.max(reasons), &[1, 1]).try_into().expect("two panels");
let cut = |top: f32, bottom: f32| {
egui::Rect::from_min_max(egui::pos2(left.left(), top), egui::pos2(left.right(), bottom))
};
let a = cut(left.top(), left.top() + where_h);
let b = cut(a.bottom() + gap, a.bottom() + gap + languages_h);
let c = cut(b.bottom() + gap, left.bottom());
let (_, a) = style::panel(ui, a, "Where compiles went", |ui| where_went::section(ui, view));
let (_, b) = style::panel(ui, b, "By language", |ui| where_went::languages(ui, view));
let (_, c) = style::panel(ui, c, "Problems", |ui| problems::section(ui, view));
let (_, d) = style::panel(ui, right, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b, c, d]);
} else {
let height = l::TRIPTYCH_HEIGHT.max(l::WHERE_FIXED_HEIGHT).max(reasons); let height = l::TRIPTYCH_HEIGHT.max(l::WHERE_FIXED_HEIGHT).max(reasons);
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels"); let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
let (_, a) = style::panel(ui, a, "Where compiles went", |ui| where_went::section(ui, view)); let (_, a) = style::panel(ui, a, "Where compiles went", |ui| where_went::section(ui, view));
let (_, b) = style::panel(ui, b, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view)); let (_, b) = style::panel(ui, b, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b]); close_row(ui, &[a, b]);
let height = l::TRIPTYCH_HEIGHT let height = l::TRIPTYCH_HEIGHT.max(languages_h).max(problems_h);
.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()))
.max(problems_height(ui, view, half));
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels"); let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
let (_, a) = style::panel(ui, a, "By language", |ui| where_went::languages(ui, view)); let (_, a) = style::panel(ui, a, "By language", |ui| where_went::languages(ui, view));
let (_, b) = style::panel(ui, b, "Problems", |ui| problems::section(ui, view)); let (_, b) = style::panel(ui, b, "Problems", |ui| problems::section(ui, view));
close_row(ui, &[a, b]); close_row(ui, &[a, b]);
}
let [a] = row(ui, l::CHARTS_HEIGHT, &[2]).try_into().expect("one panel"); let [a] = row(ui, l::CHARTS_HEIGHT, &[2]).try_into().expect("one panel");
let (_, a) = style::panel(ui, a, "Over time", |ui| { let (_, a) = style::panel(ui, a, "Over time", |ui| {
overtime::section(ui, view, hidden_languages, theme::drawing::CHART_HEIGHT) overtime::section(ui, view, hidden_languages, theme::drawing::CHART_HEIGHT)
+88
View File
@@ -0,0 +1,88 @@
//! The arithmetic of a list of lines that open: which start open, how tall the
//! list is, and whether stacking panels beside it wastes less room. No drawing
//! here, so it is tested natively.
/// A line that opens to show a text beneath it, laid out for a width.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Entry {
/// The line itself.
pub row: f32,
pub open: bool,
/// The first paragraph's height; used only when open.
pub meaning: f32,
/// The second paragraph's height, `None` when there is none; used only when open.
pub action: Option<f32>,
}
/// Whether a line is open: what was clicked, else open when `fixable`.
pub fn is_open(stored: Option<bool>, fixable: bool) -> bool {
stored.unwrap_or(fixable)
}
/// How tall one line is: `gap` between its parts, `pad` under the open text.
pub fn entry_height(entry: &Entry, gap: f32, pad: f32) -> f32 {
if !entry.open {
return entry.row;
}
let action = entry.action.map_or(0.0, |height| gap + height);
entry.row + gap + entry.meaning + action + pad
}
/// How tall the whole list is: its lines and a hairline `separator` tall between them.
pub fn list_height(entries: &[Entry], gap: f32, pad: f32, separator: f32) -> f32 {
let lines: f32 = entries.iter().map(|entry| entry_height(entry, gap, pad)).sum();
lines + entries.len().saturating_sub(1) as f32 * separator
}
/// Whether to stack the panels (`stacked` tall in all) beside a panel `beside` tall rather
/// than put the one `single` panel there: yes when that leaves less empty room.
pub fn stack_beside(single: f32, stacked: f32, beside: f32) -> bool {
(stacked - beside).abs() < (single - beside).abs()
}
#[cfg(test)]
mod tests {
use super::*;
fn entry(open: bool) -> Entry {
Entry { row: 28.0, open, meaning: 45.0, action: Some(30.0) }
}
#[test]
fn only_fixable_lines_start_open() {
assert!(is_open(None, true));
assert!(!is_open(None, false));
}
#[test]
fn a_click_wins_over_the_default() {
assert!(!is_open(Some(false), true));
assert!(is_open(Some(true), false));
}
#[test]
fn a_closed_line_is_one_row_and_an_open_one_adds_its_text() {
assert_eq!(entry_height(&entry(false), 3.0, 8.0), 28.0);
assert_eq!(entry_height(&entry(true), 3.0, 8.0), 28.0 + 3.0 + 45.0 + 3.0 + 30.0 + 8.0);
let no_action = Entry { action: None, ..entry(true) };
assert_eq!(entry_height(&no_action, 3.0, 8.0), 28.0 + 3.0 + 45.0 + 8.0);
}
#[test]
fn a_list_is_its_lines_and_the_hairlines_between() {
let list = [entry(true), entry(false), entry(false)];
assert_eq!(list_height(&list, 3.0, 8.0, 1.0), 117.0 + 28.0 + 28.0 + 2.0);
assert_eq!(list_height(&[], 3.0, 8.0, 1.0), 0.0);
assert_eq!(list_height(&[entry(false)], 3.0, 8.0, 1.0), 28.0);
}
#[test]
fn stacking_is_chosen_only_when_it_fills_the_room_better() {
// Everything closed: the lone panel (244) is close to the list (300); three stacked (500) are not.
assert!(!stack_beside(244.0, 500.0, 300.0));
// Two open: the list (520) is nearer the stack.
assert!(stack_beside(244.0, 500.0, 520.0));
// A tie keeps the simple layout.
assert!(!stack_beside(200.0, 400.0, 300.0));
}
}
+1
View File
@@ -1,6 +1,7 @@
//! The sccache-dash dashboard page. `trunk` compiles this to WebAssembly and //! The sccache-dash dashboard page. `trunk` compiles this to WebAssembly and
//! the sccache-dash server serves it at http://127.0.0.1:8226. //! the sccache-dash server serves it at http://127.0.0.1:8226.
pub mod disclosure;
pub mod fmt; pub mod fmt;
// Drawing needs eframe, which is only built for the browser so far; the rest // Drawing needs eframe, which is only built for the browser so far; the rest
+93 -38
View File
@@ -6,8 +6,9 @@ use std::sync::Arc;
use eframe::egui::{self, Color32, Sense, Stroke, Ui}; use eframe::egui::{self, Color32, Sense, Stroke, Ui};
use eframe::epaint::text::Galley; use eframe::epaint::text::Galley;
use sccache_dash_api::View; use sccache_dash_api::{NotCached, View};
use crate::disclosure;
use crate::fmt; use crate::fmt;
use crate::style::{self, Cell}; use crate::style::{self, Cell};
use crate::theme; use crate::theme;
@@ -57,32 +58,47 @@ pub fn section(ui: &mut Ui, view: &View) {
)); ));
} }
/// One reason laid out for a width: its name, numbers and the two small paragraphs. /// One reason laid out for a width: its line, and the two small paragraphs when it is open.
struct Block { struct Block {
name: Arc<Galley>, name: Arc<Galley>,
count: Arc<Galley>, count: Arc<Galley>,
share: Arc<Galley>, share: Arc<Galley>,
meaning: Arc<Galley>, /// `None` while the reason is closed.
/// `None` when sccache gives nothing to do. meaning: Option<Arc<Galley>>,
/// `None` when closed, or when sccache gives nothing to do.
action: Option<Arc<Galley>>, action: Option<Arc<Galley>>,
/// The first line: the name, or as tall as the name when it wraps. /// The line: at least a control tall, taller when the name wraps.
row: f32, row: f32,
open: bool,
} }
impl Block { impl Block {
/// Its height, counting the room each part is given. fn entry(&self) -> disclosure::Entry {
fn height(&self) -> f32 { disclosure::Entry {
let line = theme::space::LINE; row: self.row,
let mut height = self.row + line + self.meaning.size().y + line; open: self.open,
if let Some(action) = &self.action { meaning: self.meaning.as_ref().map_or(0.0, |g| g.size().y),
height += action.size().y + line; action: self.action.as_ref().map(|g| g.size().y),
} }
height
} }
} }
/// How far the name is from the numbers, and from the dot. /// How far the name is from the numbers, and from the dot.
const NAME_GAP: f32 = 8.0; const NAME_GAP: f32 = 8.0;
/// The side of the chevron's triangle box.
const CHEVRON: f32 = 8.0;
/// The hairline between two lines.
const SEPARATOR: f32 = 1.0;
/// Where a reason remembers whether it is open.
fn open_id(reason: &str) -> egui::Id {
egui::Id::new(("reason-open", reason))
}
fn is_open(ctx: &egui::Context, reason: &NotCached) -> bool {
let stored = ctx.data(|data| data.get_temp::<bool>(open_id(&reason.reason)));
disclosure::is_open(stored, reason.fixable)
}
/// Lay every reason out in `width`; counts and shares line up in columns, the name takes the rest. /// Lay every reason out in `width`; counts and shares line up in columns, the name takes the rest.
fn blocks(ui: &Ui, view: &View, width: f32) -> Vec<Block> { fn blocks(ui: &Ui, view: &View, width: f32) -> Vec<Block> {
@@ -96,29 +112,43 @@ fn blocks(ui: &Ui, view: &View, width: f32) -> Vec<Block> {
numbers.iter().map(|n| pick(n).size().x).fold(0.0, f32::max) numbers.iter().map(|n| pick(n).size().x).fold(0.0, f32::max)
}; };
let (count_width, share_width) = (widest(|n| &n.0), widest(|n| &n.1)); let (count_width, share_width) = (widest(|n| &n.0), widest(|n| &n.1));
let dot = theme::drawing::SEVERITY_DOT + NAME_GAP; let indent = theme::drawing::SEVERITY_DOT + NAME_GAP;
let name_width = (width - dot - count_width - share_width - 2.0 * NAME_GAP).max(40.0); let name_width = (width - indent - count_width - share_width - CHEVRON - 3.0 * NAME_GAP).max(40.0);
view.not_cached view.not_cached
.iter() .iter()
.zip(numbers) .zip(numbers)
.map(|(r, (count, share))| { .map(|(r, (count, share))| {
let name = style::galley(ui, theme::body(r.name.clone()), true, name_width); let name = style::galley(ui, theme::body(r.name.clone()), true, name_width);
let small = |text: &str| style::galley(ui, theme::small(ui, text), true, width); let open = is_open(ui.ctx(), r);
let small = |text: &str| style::galley(ui, theme::small(ui, text), true, width - indent);
Block { Block {
row: theme::space::ROW.max(name.size().y + 6.0), row: theme::space::CONTROL_HEIGHT.max(name.size().y + 2.0 * theme::space::ITEM),
name, name,
count, count,
share, share,
meaning: small(&r.meaning), meaning: open.then(|| small(&r.meaning)),
action: (!r.action.is_empty()).then(|| small(&r.action)), action: (open && !r.action.is_empty()).then(|| small(&r.action)),
open,
} }
}) })
.collect() .collect()
} }
/// "Why compiles were not cacheable": each reason with a dot (the warning colour when a /// A triangle in the muted colour: pointing right when closed, down when open.
/// setting would fix it, the muted one when it is expected), its plain name, its count and fn chevron(painter: &egui::Painter, center: egui::Pos2, open: bool, color: Color32) {
/// share, and under it, in small print, what it means and what to do. let h = CHEVRON / 2.0;
let points = if open {
vec![center + egui::vec2(-h, -h / 2.0), center + egui::vec2(h, -h / 2.0), center + egui::vec2(0.0, h / 2.0 + 1.0)]
} else {
vec![center + egui::vec2(-h / 2.0, -h), center + egui::vec2(-h / 2.0, h), center + egui::vec2(h / 2.0 + 1.0, 0.0)]
};
painter.add(egui::Shape::convex_polygon(points, color, Stroke::NONE));
}
/// "Why compiles were not cacheable": one line per reason, each with a dot (the warning
/// colour when a setting would fix it, the muted one when it is expected), its plain name,
/// its count and share, and a chevron. Clicking the line shows, in small print under it,
/// what it means and what to do; the reasons a setting would fix start open.
pub fn reasons(ui: &mut Ui, view: &View) { pub fn reasons(ui: &mut Ui, view: &View) {
if view.not_cached.is_empty() { if view.not_cached.is_empty() {
ui.label(theme::small(ui, "Every compile could be cached in this range.")); ui.label(theme::small(ui, "Every compile could be cached in this range."));
@@ -127,27 +157,53 @@ pub fn reasons(ui: &mut Ui, view: &View) {
let p = theme::ui(ui); let p = theme::ui(ui);
let width = ui.available_width(); let width = ui.available_width();
let blocks = blocks(ui, view, width); let blocks = blocks(ui, view, width);
let indent = theme::drawing::SEVERITY_DOT + NAME_GAP;
// Every height is added by hand, so the list is as tall as `reasons_height` says.
ui.spacing_mut().item_spacing.y = 0.0;
for (index, (reason, block)) in view.not_cached.iter().zip(&blocks).enumerate() { for (index, (reason, block)) in view.not_cached.iter().zip(&blocks).enumerate() {
if index > 0 { if index > 0 {
let (gap, _) = ui.allocate_exact_size(egui::vec2(width, theme::space::BETWEEN_PARTS), Sense::hover()); let (gap, _) = ui.allocate_exact_size(egui::vec2(width, SEPARATOR), Sense::hover());
ui.painter().hline(gap.x_range(), gap.center().y.round() + 0.5, Stroke::new(1.0, p.grid)); ui.painter().rect_filled(gap, 0.0, p.grid);
}
let (row, response) = ui.allocate_exact_size(egui::vec2(width, block.row), Sense::click());
let response = response.on_hover_cursor(egui::CursorIcon::PointingHand);
response.widget_info(|| {
egui::WidgetInfo::labeled(egui::WidgetType::Button, true, reason.name.as_str())
});
if response.clicked() {
ui.ctx().data_mut(|data| data.insert_temp(open_id(&reason.reason), !block.open));
ui.ctx().request_repaint();
} }
let (row, _) = ui.allocate_exact_size(egui::vec2(width, block.row), Sense::hover());
let painter = ui.painter(); let painter = ui.painter();
if response.hovered() || response.has_focus() {
painter.rect_filled(row, theme::space::CONTROL_RADIUS, p.hover);
}
if response.has_focus() {
painter.rect_stroke(row, theme::space::CONTROL_RADIUS, Stroke::new(1.0, p.muted), egui::StrokeKind::Inside);
}
let side = theme::drawing::SEVERITY_DOT; let side = theme::drawing::SEVERITY_DOT;
let dot = if reason.fixable { p.warn } else { p.not_cacheable }; let dot = if reason.fixable { p.warn } else { p.not_cacheable };
let name_top = row.top() + (block.row - block.name.size().y) / 2.0; let name_top = row.top() + (block.row - block.name.size().y) / 2.0;
painter.circle_filled(egui::pos2(row.left() + side / 2.0, name_top + 8.0), side / 2.0, dot); painter.circle_filled(egui::pos2(row.left() + side / 2.0, row.center().y), side / 2.0, dot);
painter.galley(egui::pos2(row.left() + side + NAME_GAP, name_top), block.name.clone(), p.text); painter.galley(egui::pos2(row.left() + indent, name_top), block.name.clone(), p.text);
let share_left = row.right() - block.share.size().x; let chevron_left = row.right() - CHEVRON;
let at = |galley: &Arc<Galley>, right: f32| { chevron(painter, egui::pos2(chevron_left + CHEVRON / 2.0, row.center().y), block.open, p.muted);
egui::pos2(right - galley.size().x, row.top() + (block.row - galley.size().y) / 2.0) let share_left = chevron_left - NAME_GAP - block.share.size().x;
let at = |galley: &Arc<Galley>, left: f32| {
egui::pos2(left, row.top() + (block.row - galley.size().y) / 2.0)
}; };
painter.galley(at(&block.share, row.right()), block.share.clone(), p.text); painter.galley(at(&block.share, share_left), block.share.clone(), p.text);
painter.galley(at(&block.count, share_left - NAME_GAP), block.count.clone(), p.text); let count_left = share_left - NAME_GAP - block.count.size().x;
for galley in std::iter::once(&block.meaning).chain(block.action.as_ref()) { painter.galley(at(&block.count, count_left), block.count.clone(), p.text);
let (place, _) = ui.allocate_exact_size(galley.size(), Sense::hover()); let mut opened = false;
ui.painter().galley(place.min, galley.clone(), p.muted); for galley in block.meaning.iter().chain(block.action.as_ref()) {
ui.add_space(theme::space::LINE);
let (place, _) = ui.allocate_exact_size(egui::vec2(width, galley.size().y), Sense::hover());
ui.painter().galley(egui::pos2(place.left() + indent, place.top()), galley.clone(), p.muted);
opened = true;
}
if opened {
ui.add_space(theme::space::ITEM);
} }
} }
} }
@@ -155,10 +211,9 @@ pub fn reasons(ui: &mut Ui, view: &View) {
/// How tall "Why compiles were not cacheable" is in a panel `panel_width` wide. /// How tall "Why compiles were not cacheable" is in a panel `panel_width` wide.
pub fn reasons_height(ui: &Ui, view: &View, panel_width: f32) -> f32 { pub fn reasons_height(ui: &Ui, view: &View, panel_width: f32) -> f32 {
let inner = panel_width - 2.0 * (theme::space::PANEL_PADDING + 1.0); let inner = panel_width - 2.0 * (theme::space::PANEL_PADDING + 1.0);
let blocks = blocks(ui, view, inner); let entries: Vec<_> = blocks(ui, view, inner).iter().map(Block::entry).collect();
let gaps = blocks.len().saturating_sub(1) as f32 * (theme::space::BETWEEN_PARTS + theme::space::LINE); let list = disclosure::list_height(&entries, theme::space::LINE, theme::space::ITEM, SEPARATOR);
let content: f32 = blocks.iter().map(Block::height).sum(); theme::layout::REASONS_FIXED_HEIGHT + list.max(theme::space::ROW)
theme::layout::REASONS_FIXED_HEIGHT + content.max(theme::space::ROW) + gaps
} }
/// "By language": one row per language, with hits, misses, errors, the hit rate /// "By language": one row per language, with hits, misses, errors, the hit rate