# Ignore tokens that were not created via \`WorkDoneProgressCreate\` · gitcafe/zed

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

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

Visibility: public

Requested revision: ca1d0a6e5958598d299cf1cc7936bb6330760903

Requested commit: ca1d0a6e5958598d299cf1cc7936bb6330760903

Commit: ca1d0a6e5958598d299cf1cc7936bb6330760903

Tree: b77373725b9a79baf6470a0bad94b1904a07d518

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Ignore tokens that were not created via `WorkDoneProgressCreate`

With the new version of rust-analyzer, we were seeing stray `WorkDoneProgress::End`
messages that create an imbalance in the `pending_diagnostic_updates` that never
resolves. This was causing the diagnostic status bar item to never update because
we wouldn't emit `DiskBasedDiagnosticsStarted` nor `DiskBasedDiagnosticsFinished`.

This commit fixes the above situation by only acknowledging progress report for tokens
that have explicitly been created via the `WorkDoneProgressCreate` request, as stated
by the protocol.

In addition to that, we are replacing the `pending_diagnostic_updates: isize` with
a `has_pending_diagnostic_updates: bool`. We added it at some point to prevent a similar
issue where we would observe begin/end reports in a seemingly random order, which would cause
us to permanently display a `checking...` message in the status bar. I believe this commit
fixes that as well because the `isize` was just a less general solution for the same
underlying issue. As the protocol states: "the token provided in the create request should
only be used once (e.g. only one begin, many report and one end notification should be sent
to it)."

```

## Parents

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

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