Improve diagnostic header UI (#9888)

This PR rearranges the diagnostics to put the headers to the left of the
diagnostic messages and adds an additional button to close the
diagnostics.

<img width="394" alt="Screenshot 2024-03-27 at 2 01 19 PM"
src="https://github.com/zed-industries/zed/assets/2280405/83be4051-6441-47c6-9b48-77c75ce9c8eb">

<img width="326" alt="Screenshot 2024-03-27 at 2 01 56 PM"
src="https://github.com/zed-industries/zed/assets/2280405/d849ca34-91e9-4de6-9d9c-503b75e97d60">

As a drive by, I also quieted a useless but loud log message.

Release Notes:

- Added a close button to the `f8` diagnostics.
This commit is contained in:
Mikayla Maki 2024-03-27 14:30:27 -07:00 committed by GitHub
parent 80242584e7
commit 9bce5e8b82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 23 deletions

View file

@ -2480,6 +2480,13 @@ impl From<ScaledPixels> for f64 {
#[derive(Clone, Copy, Default, Add, Sub, Mul, Div, Neg, PartialEq)]
pub struct Rems(pub f32);
impl Rems {
/// Convert this Rem value to pixels.
pub fn to_pixels(&self, rem_size: Pixels) -> Pixels {
*self * rem_size
}
}
impl Mul<Pixels> for Rems {
type Output = Pixels;
@ -2555,7 +2562,7 @@ impl AbsoluteLength {
pub fn to_pixels(&self, rem_size: Pixels) -> Pixels {
match self {
AbsoluteLength::Pixels(pixels) => *pixels,
AbsoluteLength::Rems(rems) => *rems * rem_size,
AbsoluteLength::Rems(rems) => rems.to_pixels(rem_size),
}
}
}