Don't show squiggles on unnecesarry code (#32082)

Co-Authored-By: @davidhewitt <mail@davidhewitt.dev>

Closes #31747
Closes https://github.com/zed-industries/zed/issues/32080

Release Notes:

- Fixed a recently introduced bug where unnecessary code was underlined
with blue squiggles

Co-authored-by: @davidhewitt <mail@davidhewitt.dev>
This commit is contained in:
Conrad Irwin 2025-06-04 09:46:06 -06:00 committed by GitHub
parent beb0d49dc4
commit 6de37fa57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -961,7 +961,10 @@ impl DisplaySnapshot {
if chunk.is_unnecessary { if chunk.is_unnecessary {
diagnostic_highlight.fade_out = Some(editor_style.unnecessary_code_fade); diagnostic_highlight.fade_out = Some(editor_style.unnecessary_code_fade);
} }
if chunk.underline && editor_style.show_underlines { if chunk.underline
&& editor_style.show_underlines
&& !(chunk.is_unnecessary && severity > lsp::DiagnosticSeverity::WARNING)
{
let diagnostic_color = super::diagnostic_style(severity, &editor_style.status); let diagnostic_color = super::diagnostic_style(severity, &editor_style.status);
diagnostic_highlight.underline = Some(UnderlineStyle { diagnostic_highlight.underline = Some(UnderlineStyle {
color: Some(diagnostic_color), color: Some(diagnostic_color),