# Refresh diagnostics inside the tab \(\#3225\) · gitcafe/zed

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

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

Visibility: public

Requested revision: edacffab58ade230756100c53f8ea15fa02ff4cb

Requested commit: edacffab58ade230756100c53f8ea15fa02ff4cb

Commit: edacffab58ade230756100c53f8ea15fa02ff4cb

Tree: 35ec83a3e6b7a0207705633f85bd0cc432c7aea2

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Refresh diagnostics inside the tab (#3225)

r-a now has 2 different types of diagnostics: 
* "disk-based" ones that come from `cargo check` and related, that emit
`project::Event::DiskBasedDiagnosticsStarted` and
`DiskBasedDiagnosticsFinished`
* "flycheck" diagnostics from r-a itself, that it tries to dynamically
apply to every buffer open, that come with `DiagnosticsUpdated` event.

Latter diagnostics update frequently, on every file close and open, but
`diagnostics.rs` logic had never polled for new diagnostics after
registering the `DiagnosticsUpdated` event, so the only way we could
have newer diagnostics was to re-open the whole panel.
The PR fixes that, and also adds more debug logging to the module.
The logic of the fix looks very familiar to previous related fix:
https://github.com/zed-industries/zed/pull/3128

One notable thing after the fix: "flycheck" diagnostics stay forever if
the diagnostics panel is opened: excerpts in that panel do not allow the
buffer to get dropped (hence, closed in terms of r-a) and get the
updated, zero diagnostics.
If the diagnostics panel is opened and closed multiple times, those
errors gradually disappear.

Release Notes:

- Fixed diagnostics panel not refreshing its contents properly
```

## Parents

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

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

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