# lsp-config: Allow setting a server's environment variables \(\#27213\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7ade7d8e45620669c6e5d313aeeeb902933e7025

Requested commit: 7ade7d8e45620669c6e5d313aeeeb902933e7025

Commit: 7ade7d8e45620669c6e5d313aeeeb902933e7025

Tree: 950f43fdb396b9a074cf9b236366122333acd8de

Author: David Barsky

Committer: GitHub

## Message

````
lsp-config: Allow setting a server's environment variables (#27213)

Closes https://github.com/zed-industries/zed/issues/14334, allowing
users to set environment variables for a language server binary like:

```json
"lsp": {
  "rust-analyzer": {
    "binary": {
      "path": "/Users/dbarsky/.cargo/bin/rust-analyzer",
      "env": {
        "RA_PROFILE": "*>100"
      }
    },
  }
}
```

The newly introduced environment variables are merged with the shell
environment. Perhaps more controversially, I've _also_ removed the
trimming/`stderr:`-prefixing of language server logs. This because
rust-analyzer has some nice, tree-shaped profiling built-in, and it
prevents us from printing profiles like this:

<details>
<img width="1147" alt="Screenshot 2025-03-20 at 12 09 14 PM"
src="https://github.com/user-attachments/assets/b7066651-6394-492b-b745-906c66d3c7b2"
/>
</details>

Release Notes:

- Added the ability to set a language server's environment variables.
- Removed the `stderr`-prefix of a language server's stderr logs.
````

## Parents

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

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