Tweak diagnostic header styling

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-01-25 15:33:49 -08:00
parent e04e929010
commit cefb63936d
6 changed files with 10 additions and 6 deletions

View file

@ -745,7 +745,7 @@ fn diagnostic_header_renderer(
})) }))
.contained() .contained()
.with_style(style.container) .with_style(style.container)
.with_padding_left(cx.gutter_width - cx.gutter_padding - icon_width) .with_padding_left(cx.gutter_padding)
.expanded() .expanded()
.named("diagnostic header") .named("diagnostic header")
}) })
@ -1254,6 +1254,7 @@ mod tests {
anchor_x: 0., anchor_x: 0.,
gutter_padding: 0., gutter_padding: 0.,
gutter_width: 0., gutter_width: 0.,
line_height: 0.,
em_width: 0., em_width: 0.,
}) })
.name() .name()

View file

@ -72,6 +72,7 @@ pub struct BlockContext<'a> {
pub gutter_width: f32, pub gutter_width: f32,
pub gutter_padding: f32, pub gutter_padding: f32,
pub em_width: f32, pub em_width: f32,
pub line_height: f32,
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
@ -951,6 +952,7 @@ mod tests {
anchor_x: 0., anchor_x: 0.,
gutter_padding: 0., gutter_padding: 0.,
gutter_width: 0., gutter_width: 0.,
line_height: 0.,
em_width: 0., em_width: 0.,
}) })
.name() .name()

View file

@ -617,6 +617,7 @@ impl EditorElement {
cx, cx,
anchor_x, anchor_x,
gutter_padding, gutter_padding,
line_height,
gutter_width, gutter_width,
em_width, em_width,
}); });

View file

@ -334,6 +334,8 @@ impl View for DiagnosticMessage {
diagnostic.message.lines().next().unwrap().to_string(), diagnostic.message.lines().next().unwrap().to_string(),
theme.diagnostic_message.clone(), theme.diagnostic_message.clone(),
) )
.contained()
.with_margin_left(theme.item_spacing)
.boxed() .boxed()
} else { } else {
Empty::new().boxed() Empty::new().boxed()

View file

@ -109,10 +109,8 @@ pub struct StatusBar {
#[serde(flatten)] #[serde(flatten)]
pub container: ContainerStyle, pub container: ContainerStyle,
pub height: f32, pub height: f32,
pub item_spacing: f32,
pub cursor_position: TextStyle, pub cursor_position: TextStyle,
pub diagnostic_icon_size: f32,
pub diagnostic_icon_spacing: f32,
pub diagnostic_icon_color: Color,
pub diagnostic_message: TextStyle, pub diagnostic_message: TextStyle,
} }

View file

@ -252,13 +252,13 @@ guest_selections = "$selection.guests"
error_color = "$status.bad" error_color = "$status.bad"
[editor.diagnostic_path_header] [editor.diagnostic_path_header]
background = "$state.active_line"
filename = { extends = "$text.0", size = 14 } filename = { extends = "$text.0", size = 14 }
path = { extends = "$text.2", size = 14, margin.left = 12 } path = { extends = "$text.2", size = 14, margin.left = 12 }
text_scale_factor = 0.857 text_scale_factor = 0.857
[editor.diagnostic_header] [editor.diagnostic_header]
background = "$state.active_line" border = { width = 1, top = true, bottom = true, color = "#ffffff1c" }
border = { width = 1, top = true, bottom = true, color = "$border.0" }
code = { extends = "$text.2", size = 14, margin.left = 10 } code = { extends = "$text.2", size = 14, margin.left = 10 }
icon_width_factor = 1.5 icon_width_factor = 1.5
text_scale_factor = 0.857 text_scale_factor = 0.857