# Fix LSP violation when dismissing server notifications \(\#23531\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 95c045ad9396f0a327aea61f7b46eaf35b97ec82

Requested commit: 95c045ad9396f0a327aea61f7b46eaf35b97ec82

Commit: 95c045ad9396f0a327aea61f7b46eaf35b97ec82

Tree: 4d5ecf7f30d6a3870a89bdc8c31219a03016b308

Author: Kirill Bulatov

Committer: GitHub

## Message

````
Fix LSP violation when dismissing server notifications (#23531)

Part of https://github.com/zed-industries/zed/issues/22606
Closes https://github.com/zed-industries/zed/issues/23509

When a user sees an odd notification from the language server like

<img width="508" alt="image"
src="https://github.com/user-attachments/assets/6f5ef1aa-0f09-4705-a02a-aaf81dd8620c"
/>

they usually dismiss that.

Zed uses channels to wait and handle user interactions with such
notifications, and, due to `?`, sends back
```json
{"jsonrpc":"2.0","id":1,"error":{"message":"receiving from an empty and closed channel"}}
```

which is not spec-compliant:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showMessageRequest

> Response:
>
> * result: the selected
[MessageActionItem](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#messageActionItem)
| null if none got selected.
> * error: code and message set in case an exception happens during
showing a message.

Unfortunately, vtsls (and, potentially, others) crash if receive such
non-compliant requests, and do not get back.

After the fix, the message is correct:
```json
{"jsonrpc":"2.0","id":1,"result":null}
```


Release Notes:

- Fixed vtsls crashing on notification dismiss

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
````

## Parents

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

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