Allow LSP adapters to decide, which diagnostics to underline (#31450)

Closes
https://github.com/zed-industries/zed/pull/31355#issuecomment-2910439798

<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/2eaa8e9b-00bc-4e99-ac09-fceb2d932e41"
/>


Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-05-26 22:19:02 +03:00 committed by GitHub
parent 4c396bcc91
commit 4567360fd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 53 additions and 5 deletions

View file

@ -960,11 +960,8 @@ impl DisplaySnapshot {
}) {
if chunk.is_unnecessary {
diagnostic_highlight.fade_out = Some(editor_style.unnecessary_code_fade);
// 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 {
}
if chunk.underline && editor_style.show_underlines {
let diagnostic_color = super::diagnostic_style(severity, &editor_style.status);
diagnostic_highlight.underline = Some(UnderlineStyle {
color: Some(diagnostic_color),