parent
6986ac4c27
commit
209b1d1931
2 changed files with 22 additions and 33 deletions
|
@ -720,8 +720,7 @@ impl DisplaySnapshot {
|
||||||
if let Some(severity) = chunk.diagnostic_severity {
|
if let Some(severity) = chunk.diagnostic_severity {
|
||||||
// Omit underlines for HINT/INFO diagnostics on 'unnecessary' code.
|
// Omit underlines for HINT/INFO diagnostics on 'unnecessary' code.
|
||||||
if severity <= DiagnosticSeverity::WARNING || !chunk.is_unnecessary {
|
if severity <= DiagnosticSeverity::WARNING || !chunk.is_unnecessary {
|
||||||
let diagnostic_color =
|
let diagnostic_color = super::diagnostic_style(severity, &editor_style.status);
|
||||||
super::diagnostic_style(severity, true, &editor_style.status);
|
|
||||||
diagnostic_highlight.underline = Some(UnderlineStyle {
|
diagnostic_highlight.underline = Some(UnderlineStyle {
|
||||||
color: Some(diagnostic_color),
|
color: Some(diagnostic_color),
|
||||||
thickness: 1.0.into(),
|
thickness: 1.0.into(),
|
||||||
|
@ -957,16 +956,18 @@ impl DisplaySnapshot {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for next_row in (buffer_row.0 + 1)..=max_row.0 {
|
(buffer_row.0 + 1..=max_row.0)
|
||||||
let next_line_indent = self.line_indent_for_buffer_row(MultiBufferRow(next_row));
|
.find_map(|next_row| {
|
||||||
if next_line_indent.raw_len() > line_indent.raw_len() {
|
let next_line_indent = self.line_indent_for_buffer_row(MultiBufferRow(next_row));
|
||||||
return true;
|
if next_line_indent.raw_len() > line_indent.raw_len() {
|
||||||
} else if !next_line_indent.is_line_blank() {
|
Some(true)
|
||||||
break;
|
} else if !next_line_indent.is_line_blank() {
|
||||||
}
|
Some(false)
|
||||||
}
|
} else {
|
||||||
|
None
|
||||||
false
|
}
|
||||||
|
})
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn foldable_range(
|
pub fn foldable_range(
|
||||||
|
|
|
@ -8816,13 +8816,7 @@ impl Editor {
|
||||||
let display_point = initial_point.to_display_point(snapshot);
|
let display_point = initial_point.to_display_point(snapshot);
|
||||||
let mut hunks = hunks
|
let mut hunks = hunks
|
||||||
.map(|hunk| diff_hunk_to_display(&hunk, &snapshot))
|
.map(|hunk| diff_hunk_to_display(&hunk, &snapshot))
|
||||||
.filter(|hunk| {
|
.filter(|hunk| is_wrapped || !hunk.contains_display_row(display_point.row()))
|
||||||
if is_wrapped {
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
!hunk.contains_display_row(display_point.row())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.dedup();
|
.dedup();
|
||||||
|
|
||||||
if let Some(hunk) = hunks.next() {
|
if let Some(hunk) = hunks.next() {
|
||||||
|
@ -12521,7 +12515,7 @@ pub fn diagnostic_block_renderer(diagnostic: Diagnostic, _is_valid: bool) -> Ren
|
||||||
let group_id: SharedString = cx.block_id.to_string().into();
|
let group_id: SharedString = cx.block_id.to_string().into();
|
||||||
|
|
||||||
let mut text_style = cx.text_style().clone();
|
let mut text_style = cx.text_style().clone();
|
||||||
text_style.color = diagnostic_style(diagnostic.severity, true, cx.theme().status());
|
text_style.color = diagnostic_style(diagnostic.severity, cx.theme().status());
|
||||||
let theme_settings = ThemeSettings::get_global(cx);
|
let theme_settings = ThemeSettings::get_global(cx);
|
||||||
text_style.font_family = theme_settings.buffer_font.family.clone();
|
text_style.font_family = theme_settings.buffer_font.family.clone();
|
||||||
text_style.font_style = theme_settings.buffer_font.style;
|
text_style.font_style = theme_settings.buffer_font.style;
|
||||||
|
@ -12617,25 +12611,19 @@ pub fn highlight_diagnostic_message(diagnostic: &Diagnostic) -> (SharedString, V
|
||||||
prev_offset = ix + 1;
|
prev_offset = ix + 1;
|
||||||
if in_code_block {
|
if in_code_block {
|
||||||
code_ranges.push(prev_len..text_without_backticks.len());
|
code_ranges.push(prev_len..text_without_backticks.len());
|
||||||
in_code_block = false;
|
|
||||||
} else {
|
|
||||||
in_code_block = true;
|
|
||||||
}
|
}
|
||||||
|
in_code_block = !in_code_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
(text_without_backticks.into(), code_ranges)
|
(text_without_backticks.into(), code_ranges)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn diagnostic_style(severity: DiagnosticSeverity, valid: bool, colors: &StatusColors) -> Hsla {
|
fn diagnostic_style(severity: DiagnosticSeverity, colors: &StatusColors) -> Hsla {
|
||||||
match (severity, valid) {
|
match severity {
|
||||||
(DiagnosticSeverity::ERROR, true) => colors.error,
|
DiagnosticSeverity::ERROR => colors.error,
|
||||||
(DiagnosticSeverity::ERROR, false) => colors.error,
|
DiagnosticSeverity::WARNING => colors.warning,
|
||||||
(DiagnosticSeverity::WARNING, true) => colors.warning,
|
DiagnosticSeverity::INFORMATION => colors.info,
|
||||||
(DiagnosticSeverity::WARNING, false) => colors.warning,
|
DiagnosticSeverity::HINT => colors.info,
|
||||||
(DiagnosticSeverity::INFORMATION, true) => colors.info,
|
|
||||||
(DiagnosticSeverity::INFORMATION, false) => colors.info,
|
|
||||||
(DiagnosticSeverity::HINT, true) => colors.info,
|
|
||||||
(DiagnosticSeverity::HINT, false) => colors.info,
|
|
||||||
_ => colors.ignored,
|
_ => colors.ignored,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue