@@ -1,5 +1,7 @@
1use std::fmt::Write;
1use std::fmt::Write;
3+use helix_core::{syntax::LanguageServerFeature, Diagnostic};
3use crate::{
5use crate::{
4 editor::GutterType,
6 editor::GutterType,
5 graphics::{Style, UnderlineStyle},
7 graphics::{Style, UnderlineStyle},
@@ -55,7 +57,7 @@ pub fn diagnostic<'doc>(
55 let error = theme.get("error");
57 let error = theme.get("error");
56 let info = theme.get("info");
58 let info = theme.get("info");
57 let hint = theme.get("hint");
59 let hint = theme.get("hint");
58− let diagnostics = doc.shown_diagnostics().collect::<Vec<_>>();
60+ let diagnostics = &doc.diagnostics;
61 move |line: usize, _selected: bool, first_visual_line: bool, out: &mut String| {
63 move |line: usize, _selected: bool, first_visual_line: bool, out: &mut String| {
@@ -64,12 +66,20 @@ pub fn diagnostic<'doc>(
65 use helix_core::diagnostic::Severity;
67 use helix_core::diagnostic::Severity;
66 if let Ok(index) = diagnostics.binary_search_by_key(&line, |d| d.line) {
68 if let Ok(index) = diagnostics.binary_search_by_key(&line, |d| d.line) {
69+ let on_line_and_is_visible = |d: &&Diagnostic| {
72+ .language_servers_with_feature(LanguageServerFeature::Diagnostics)
73+ .any(|ls| ls.id() == d.language_server_id)
67− let after = diagnostics[index..].iter().take_while(|d| d.line == line);
75+ let after = diagnostics[index..]
77+ .take_while(on_line_and_is_visible);
69 let before = diagnostics[..index]
79 let before = diagnostics[..index]
72− .take_while(|d| d.line == line);
82+ .take_while(on_line_and_is_visible);
74 let diagnostics_on_line = after.chain(before);
84 let diagnostics_on_line = after.chain(before);