# Remove empty line when collapsing diagnostics \(\#39459\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f9a2724a8b85f4dd15b5af1659d3ac088c2188db)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f9a2724a8b85f4dd15b5af1659d3ac088c2188db

Requested commit: f9a2724a8b85f4dd15b5af1659d3ac088c2188db

Commit: f9a2724a8b85f4dd15b5af1659d3ac088c2188db

Tree: c43ff401132e9e4f90cd326eb7f6da5b348a3580

Author: Vinicius da Motta

Committer: GitHub

## Message

```
Remove empty line when collapsing diagnostics (#39459)

Closes #39028

Fixed empty lines appearing when collapsing files with diagnostic
messages in the diagnostics panel.

Added a flag to track when processing a `FoldedBuffer` and skip
`Near/Below` blocks (diagnostic messages) that immediately follow it.
This prevents diagnostics from rendering as empty lines when their file
is collapsed.

Before:
<img width="1489" height="429" alt="before"
src="https://github.com/user-attachments/assets/5e233290-1f6e-403c-a6b3-a65107586d01"
/>

After:
<img width="981" height="270" alt="after"
src="https://github.com/user-attachments/assets/a877b651-6b7f-4441-805c-38ea41e73a18"
/>

Release Notes:
- Fixed empty lines when collapsing files with diagnostics in the
diagnostics panel
```

## Parents

- [ded73c9d56c28cd9bf6e58adf80be3a82796052a](https://git.cafe/gitcafe/zed/commit/ded73c9d56c28cd9bf6e58adf80be3a82796052a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f9a2724a8b85f4dd15b5af1659d3ac088c2188db?format=markdown)
