Deduplicate path names in the project diagnostics view
This commit is contained in:
parent
a9937ee8be
commit
b5ee095da9
5 changed files with 120 additions and 88 deletions
|
@ -3851,47 +3851,6 @@ pub fn diagnostic_block_renderer(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn diagnostic_header_renderer(
|
||||
buffer: ModelHandle<Buffer>,
|
||||
diagnostic: Diagnostic,
|
||||
is_valid: bool,
|
||||
build_settings: BuildSettings,
|
||||
) -> RenderBlock {
|
||||
Arc::new(move |cx| {
|
||||
let settings = build_settings(cx);
|
||||
let mut text_style = settings.style.text.clone();
|
||||
let diagnostic_style = diagnostic_style(diagnostic.severity, is_valid, &settings.style);
|
||||
text_style.color = diagnostic_style.text;
|
||||
let file_path = if let Some(file) = buffer.read(&**cx).file() {
|
||||
file.path().to_string_lossy().to_string()
|
||||
} else {
|
||||
"untitled".to_string()
|
||||
};
|
||||
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Text::new(diagnostic.message.clone(), text_style)
|
||||
.with_soft_wrap(false)
|
||||
.boxed(),
|
||||
)
|
||||
.with_child(Label::new(file_path, settings.style.text.clone()).boxed())
|
||||
.aligned()
|
||||
.left()
|
||||
.contained()
|
||||
.with_style(diagnostic_style.header)
|
||||
.expanded()
|
||||
.boxed()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn context_header_renderer(build_settings: BuildSettings) -> RenderBlock {
|
||||
Arc::new(move |cx| {
|
||||
let settings = build_settings(cx);
|
||||
let text_style = settings.style.text.clone();
|
||||
Label::new("...".to_string(), text_style).boxed()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn diagnostic_style(
|
||||
severity: DiagnosticSeverity,
|
||||
valid: bool,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue