Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/diagnostics/src/diagnostics_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,7 @@ async fn active_diagnostics_dismiss_after_invalidation(cx: &mut TestAppContext)
cx.update_editor(|editor, window, cx| {
editor.go_to_diagnostic(&GoToDiagnostic::default(), window, cx);
assert_eq!(
editor
.active_diagnostic_group()
.map(|diagnostics_group| diagnostics_group.active_message.as_str()),
editor.active_diagnostic_message(),
Some(message),
"Should have a diagnostics group activated"
);
Expand Down Expand Up @@ -1069,7 +1067,7 @@ async fn active_diagnostics_dismiss_after_invalidation(cx: &mut TestAppContext)
});
cx.run_until_parked();
cx.update_editor(|editor, _, _| {
assert_eq!(editor.active_diagnostic_group(), None);
assert_eq!(editor.active_diagnostic_message(), None);
});
cx.assert_editor_state(indoc! {"
fn func(abcˇ def: i32) -> u32 {
Expand All @@ -1078,7 +1076,7 @@ async fn active_diagnostics_dismiss_after_invalidation(cx: &mut TestAppContext)

cx.update_editor(|editor, window, cx| {
editor.go_to_diagnostic(&GoToDiagnostic::default(), window, cx);
assert_eq!(editor.active_diagnostic_group(), None);
assert_eq!(editor.active_diagnostic_message(), None);
});
cx.assert_editor_state(indoc! {"
fn func(abcˇ def: i32) -> u32 {
Expand Down
16 changes: 13 additions & 3 deletions crates/editor/src/display_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub use wrap_map::{WrapPoint, WrapRow, WrapSnapshot};

use collections::{HashMap, HashSet, IndexSet};
use gpui::{
App, Context, Entity, EntityId, Font, HighlightStyle, LineLayout, Pixels, UnderlineStyle,
App, Context, Entity, EntityId, Font, HighlightStyle, Hsla, LineLayout, Pixels, UnderlineStyle,
WeakEntity,
};
use language::{
Expand All @@ -113,6 +113,7 @@ use settings::Settings;
use smallvec::SmallVec;
use sum_tree::{Bias, TreeMap};
use text::{BufferId, LineIndent, Patch};
use theme::StatusColors;
use ui::{SharedString, px};
use unicode_segmentation::UnicodeSegmentation;
use ztracing::instrument;
Expand Down Expand Up @@ -1848,8 +1849,7 @@ impl DisplaySnapshot {
&& editor_style.show_underlines
&& !(chunk.is_unnecessary && severity > lsp::DiagnosticSeverity::WARNING))
.then(|| {
let diagnostic_color =
super::diagnostic_style(severity, &editor_style.status);
let diagnostic_color = diagnostic_style(severity, &editor_style.status);
UnderlineStyle {
color: Some(diagnostic_color),
thickness: 1.0.into(),
Expand Down Expand Up @@ -2414,6 +2414,16 @@ impl DisplaySnapshot {
}
}

fn diagnostic_style(severity: lsp::DiagnosticSeverity, colors: &StatusColors) -> Hsla {
match severity {
lsp::DiagnosticSeverity::ERROR => colors.error,
lsp::DiagnosticSeverity::WARNING => colors.warning,
lsp::DiagnosticSeverity::INFORMATION => colors.info,
lsp::DiagnosticSeverity::HINT => colors.hint,
_ => colors.ignored,
}
}

impl std::ops::Deref for DisplaySnapshot {
type Target = BlockSnapshot;

Expand Down
Loading
Loading