mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-22 08:30:11 +01:00
0dea8c63d9
Closes #63084. Zed already normalizes most empty and line-terminator-only diagnostic ranges onto an adjacent character. A diagnostic can still remain a true point when its position has no glyph, such as column zero of an empty line or an empty file. The shaped-text path has no `TextRun` at that position, so the diagnostic appears in diagnostic UI but has no editor squiggle. Render only diagnostics that remain zero-width after ingress as a one-em wavy underline at their `DisplayPoint`. This keeps the stored LSP range unchanged, uses the existing diagnostic underline policy and font metrics, and also paints the decoration in a pinned sticky-header copy when an anchored point survives an edit. ## Evidence ### Empty Go file with gopls Before: <img width="471" height="430" alt="Empty Go file before the fix: diagnostic message without a squiggle" src="https://github.com/user-attachments/assets/a7f29dd3-a16c-43ea-a53f-d0264efb4ce0" /> After: <img width="471" height="430" alt="Empty Go file after the fix: diagnostic message with a point squiggle" src="https://github.com/user-attachments/assets/0546970a-e24e-4e15-a764-d548291eb623" /> `gopls` reports `expected ';', found 'EOF'` at `(0,0)..(0,0)` for the empty file. The diagnostic message is present in both builds; only the patched build paints the point squiggle. Sticky-header behavior was also verified with a deterministic stdio LSP. Before/after recordings are included in the review response below. ## Validation - `cargo test -p editor point_diagnostic` - `cargo test -p editor test_point_diagnostic_stays_in_edited_excerpt` - `cargo test -p editor test_point_diagnostics_follow_expanded_deletions` - `cargo test -p project test_empty_diagnostic_ranges` - `cargo test -p project test_diagnostic_range_spanning_line_terminator` - `cargo fmt --all -- --check` - `CCACHE_TEMPDIR=/tmp/zed-ccache-tmp ./script/clippy -p editor -p gpui -p multi_buffer -p project` - `git diff --check` - Manual before/after verification with gopls on an empty Go file - Manual before/after verification of a retained point diagnostic in a sticky header - Manual Fedora verification of physical overlap handling with `.ZedMono` and proportional Jomolhari text Regression coverage also includes retained point diagnostics across edited excerpt boundaries and expanded deleted diff hunks at the beginning, middle, and EOF, including an empty live buffer, plus painted-span severity arbitration for point-vs-range and point-vs-point overlaps. Release Notes: - Fixed missing editor underlines for language server diagnostics at positions without underlying text. - [GPUI] N/A --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: Kirill Bulatov <mail4score@gmail.com>