# lsp: Skip serializing of params if unit type \(\#46027\) · gitcafe/zed

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

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

Visibility: public

Requested revision: da53a2b22eeaddd70bfccb78f41f222e6f4491b8

Requested commit: da53a2b22eeaddd70bfccb78f41f222e6f4491b8

Commit: da53a2b22eeaddd70bfccb78f41f222e6f4491b8

Tree: 67c89b839a84fc9a2b9bf2aed1f9d424ba35fa42

Author: Michael Barth

Committer: GitHub

## Message

````
lsp: Skip serializing of params if unit type (#46027)

Closes #45994 

Per the JSON-RPC specification, `params` "MUST be provided as a
Structured value" or the member "MAY be omitted." See specification
here: https://www.jsonrpc.org/specification#request_object

The code was passing in unit `()` for params which serde_json was
serializing to `null` which is not valid.

This pulls request adds an `is_unit` function and annotates the `params`
fields in the `Request` and `Notification` structs with the following:
 ```rs
#[serde(default, skip_serializing_if = "is_unit")]
```

so that the field will be omitted if the type is unit. This does also introduce a `'static` bound to these structs.

> [!WARNING]
> While this seems to me like a simple change, I am not super familiar with Rust, please look at this PR with extra scrutiny. The last thing I want to do is break everyone's LSP integration.


Release Notes:
- LSP integrations: send language server shutdown requests with correct parameters
````

## Parents

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

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