Show diagnostic source in diagnostic multibuffer headers
This commit is contained in:
parent
f62ba2eec7
commit
f7de0ad8ae
3 changed files with 15 additions and 2 deletions
|
@ -697,8 +697,18 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
|
||||||
icon.constrained()
|
icon.constrained()
|
||||||
.with_width(icon_width)
|
.with_width(icon_width)
|
||||||
.aligned()
|
.aligned()
|
||||||
.contained(),
|
.contained()
|
||||||
|
.with_margin_right(cx.gutter_padding),
|
||||||
)
|
)
|
||||||
|
.with_children(diagnostic.source.as_ref().map(|source| {
|
||||||
|
Label::new(
|
||||||
|
format!("{source}: "),
|
||||||
|
style.source.label.clone().with_font_size(font_size),
|
||||||
|
)
|
||||||
|
.contained()
|
||||||
|
.with_style(style.message.container)
|
||||||
|
.aligned()
|
||||||
|
}))
|
||||||
.with_child(
|
.with_child(
|
||||||
Label::new(
|
Label::new(
|
||||||
message.clone(),
|
message.clone(),
|
||||||
|
@ -707,7 +717,6 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
|
||||||
.with_highlights(highlights.clone())
|
.with_highlights(highlights.clone())
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.message.container)
|
.with_style(style.message.container)
|
||||||
.with_margin_left(cx.gutter_padding)
|
|
||||||
.aligned(),
|
.aligned(),
|
||||||
)
|
)
|
||||||
.with_children(diagnostic.code.clone().map(|code| {
|
.with_children(diagnostic.code.clone().map(|code| {
|
||||||
|
|
|
@ -659,6 +659,7 @@ pub struct DiagnosticPathHeader {
|
||||||
pub struct DiagnosticHeader {
|
pub struct DiagnosticHeader {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub container: ContainerStyle,
|
pub container: ContainerStyle,
|
||||||
|
pub source: ContainedLabel,
|
||||||
pub message: ContainedLabel,
|
pub message: ContainedLabel,
|
||||||
pub code: ContainedText,
|
pub code: ContainedText,
|
||||||
pub text_scale_factor: f32,
|
pub text_scale_factor: f32,
|
||||||
|
|
|
@ -176,6 +176,9 @@ export default function editor(colorScheme: ColorScheme) {
|
||||||
left: 10,
|
left: 10,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
source: {
|
||||||
|
text: text(colorScheme.middle, "sans", { size: "sm", weight: "bold", }),
|
||||||
|
},
|
||||||
message: {
|
message: {
|
||||||
highlightText: text(colorScheme.middle, "sans", {
|
highlightText: text(colorScheme.middle, "sans", {
|
||||||
size: "sm",
|
size: "sm",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue