@@ -247,17 +247,36 @@ impl EditorView {
247 doc: &Document,
247 doc: &Document,
248 theme: &Theme,
248 theme: &Theme,
249 ) -> Vec<(usize, std::ops::Range<usize>)> {
249 ) -> Vec<(usize, std::ops::Range<usize>)> {
250− let diagnostic_scope = theme
250+ use helix_core::diagnostic::Severity;
251+ let get_scope_of = |scope| {
251− .find_scope_index("diagnostic")
253+ .find_scope_index(scope)
254+ // get one of the themes below as fallback values
255+ .or_else(|| theme.find_scope_index("diagnostic"))
252 .or_else(|| theme.find_scope_index("ui.cursor"))
256 .or_else(|| theme.find_scope_index("ui.cursor"))
253 .or_else(|| theme.find_scope_index("ui.selection"))
257 .or_else(|| theme.find_scope_index("ui.selection"))
255 "at least one of the following scopes must be defined in the theme: `diagnostic`, `ui.cursor`, or `ui.selection`",
259 "at least one of the following scopes must be defined in the theme: `diagnostic`, `ui.cursor`, or `ui.selection`",
263+ // basically just queries the theme color defined in the config
264+ let hint = get_scope_of("diagnostic.hint");
265+ let info = get_scope_of("diagnostic.info");
266+ let warning = get_scope_of("diagnostic.warning");
267+ let error = get_scope_of("diagnostic.error");
268+ let r#default = get_scope_of("diagnostic"); // this is a bit redundant but should be fine
258 doc.diagnostics()
270 doc.diagnostics()
260 .map(|diagnostic| {
272 .map(|diagnostic| {
273+ let diagnostic_scope = match diagnostic.severity {
274+ Some(Severity::Info) => info,
275+ Some(Severity::Hint) => hint,
276+ Some(Severity::Warning) => warning,
277+ Some(Severity::Error) => error,
262 diagnostic_scope,
281 diagnostic_scope,
263 diagnostic.range.start..diagnostic.range.end,
282 diagnostic.range.start..diagnostic.range.end,