Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Show diagnostic source in diagnostic multibuffer headers

Juliaf7de0ad8ae3b
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index 6973d83f9b0..22f67265ecc 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -697,8 +697,18 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
icon.constrained()
.with_width(icon_width)
.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(
Label::new(
message.clone(),
@@ -707,7 +717,6 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
.with_highlights(highlights.clone())
.contained()
.with_style(style.message.container)
- .with_margin_left(cx.gutter_padding)
.aligned(),
)
.with_children(diagnostic.code.clone().map(|code| {
diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs
index d2962847729..1211f537422 100644
--- a/crates/theme/src/theme.rs
+++ b/crates/theme/src/theme.rs
@@ -659,6 +659,7 @@ pub struct DiagnosticPathHeader {
pub struct DiagnosticHeader {
#[serde(flatten)]
pub container: ContainerStyle,
+ pub source: ContainedLabel,
pub message: ContainedLabel,
pub code: ContainedText,
pub text_scale_factor: f32,
diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts
index 84ef51406ea..cd0adf6bc7f 100644
--- a/styles/src/styleTree/editor.ts
+++ b/styles/src/styleTree/editor.ts
@@ -176,6 +176,9 @@ export default function editor(colorScheme: ColorScheme) {
left: 10,
},
},
+ source: {
+ text: text(colorScheme.middle, "sans", { size: "sm", weight: "bold", }),
+ },
message: {
highlightText: text(colorScheme.middle, "sans", {
size: "sm",