# lsp: Handle \`client/unregisterCapability\` to fix gopls \(\#12086\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b89f360199c768e84fb1c294e4322e6ba1bc19bc

Requested commit: b89f360199c768e84fb1c294e4322e6ba1bc19bc

Commit: b89f360199c768e84fb1c294e4322e6ba1bc19bc

Tree: 1f5fe31b53c14838033b23568de4954dd90ff367

Author: Thorsten Ball

Committer: GitHub

## Message

```
lsp: Handle `client/unregisterCapability` to fix gopls (#12086)

This fixes #10224 by handling `client/unregisterCapability` requests
that have a `workspace/didChangeWatchedFiles` method.

While debugging the issue, I found out that `gopls` seems to block
indefinitely when there's no reply to the `client/unregisterCapability`
request. Even an empty response would fix the issue.

Seems like gopls 15.x and later seem to handle nested subfolders well,
but do not handle unanswered requests.

Instead of replying with an empty response, I decided to change how we
handle file watching and keep a list of all registered paths so that we
can then unregister paths and recreate the glob patterns.

Release Notes:

- Fixed `gopls` not working correctly when the `go.mod` file was in a
subfolder and not the root folder of the project opened in Zed.
([#10224](https://github.com/zed-industries/zed/issues/10224)).
```

## Parents

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

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