@@ -340,6 +340,20 @@ impl EditorView {
340340 Box::new(highlights)
341341 };
342342
343+ // diagnostic injection
344+ let diagnostic_scope = theme.find_scope_index("diagnostic").unwrap_or(cursor_scope);
345+ let spans_ = doc
346+ .diagnostics()
347+ .iter()
348+ .map(|diagnostic| {
349+ (
350+ diagnostic_scope,
351+ diagnostic.range.start..diagnostic.range.end,
352+ )
353+ })
354+ .collect();
355+ let highlights = Box::new(merge(highlights, spans_));
356+
343357 'outer: for event in highlights {
344358 match event {
345359 HighlightEvent::HighlightStart(span) => {
@@ -412,18 +426,6 @@ impl EditorView {
412426 continue;
413427 }
414428
415− // ugh,interleave highlight spans with diagnostic spans
416− let is_diagnostic = doc.diagnostics().iter().any(|diagnostic| {
417− diagnostic.range.start <= char_index
418− && diagnostic.range.end > char_index
419− });
420−
421− let style = if is_diagnostic {
422− style.add_modifier(Modifier::UNDERLINED)
423− } else {
424− style
425− };
426−
427429 surface.set_string(
428430 viewport.x + visual_x - view.first_col as u16,
429431 viewport.y + line,