# Fix race when language server registers for \`workspace/didChangeWatchedFiles\` \(\#9177\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f066dd268fd9b99e373edf963f2f7b97631fb2cb

Requested commit: f066dd268fd9b99e373edf963f2f7b97631fb2cb

Commit: f066dd268fd9b99e373edf963f2f7b97631fb2cb

Tree: 64f44abc52c54bb4ef6fcbf0655aab43522c5a36

Author: Thorsten Ball

Committer: GitHub

## Message

```
Fix race when language server registers for `workspace/didChangeWatchedFiles` (#9177)

This fixes #8896 by storing the `watched_paths` in a separate HashMap,
allowing us to handle the request even before we mark the language
server as running.

Downside is that we have yet another data structure for language
servers, but it also makes the `Running` enum case a bit smaller.

And it fixes the race condition.

Release Notes:

- Fixed language servers not being notified of file changes if language
server registers for file-notification right after starting up.
([#8896](https://github.com/zed-industries/zed/issues/8896)).

Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>
```

## Parents

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

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