Do not underline unnecessary diagnostics (#31355)

Closes
https://github.com/zed-industries/zed/pull/31229#issuecomment-2906946881

Follow
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag

> Clients are allowed to render diagnostics with this tag faded out
instead of having an error squiggle.

and do not underline any unnecessary diagnostic at all.

Release Notes:

- Fixed clangd's inactive regions diagnostics excessive highlights
This commit is contained in:
Kirill Bulatov 2025-05-24 23:08:46 +03:00 committed by GitHub
parent 6f918ed99b
commit 20a0956fb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 40 deletions

View file

@ -960,8 +960,11 @@ impl DisplaySnapshot {
}) {
if chunk.is_unnecessary {
diagnostic_highlight.fade_out = Some(editor_style.unnecessary_code_fade);
}
if editor_style.show_underlines {
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
// states that
// > Clients are allowed to render diagnostics with this tag faded out instead of having an error squiggle.
// for the unnecessary diagnostics, so do not underline them.
} else if editor_style.show_underlines {
let diagnostic_color = super::diagnostic_style(severity, &editor_style.status);
diagnostic_highlight.underline = Some(UnderlineStyle {
color: Some(diagnostic_color),