mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
fc4c533d0a
This changes the Zed CLI `zed` to pass along the environment to the Zed project that it opens (if it opens a new one). In projects, this CLI environment will now take precedence over any environment that's acquired by running a login shell in a projects folder. The result is that `zed my/folder` now always behaves as if one would run `zed --foreground` without any previous Zed version running. Closes #7894 Closes #16293 Related issues: - It fixes the issue described in here: https://github.com/zed-industries/zed/issues/4977#issuecomment-2305272027 Release Notes: - Improved the Zed CLI `zed` to pass along the environment as it was on the CLI to the opened Zed project. That environment is then used when opening new terminals, spawning tasks, or language servers. Specifically: - If Zed was started via `zed my-folder`, a terminal spawned with `workspace: new terminal` will inherit these environment variables that existed on the CLI - Specific language servers that allow looking up the language server binary in the environments `$PATH` (such as `gopls`, `zls`, `rust-analyzer` if configured, ...) will look up the language server binary in the CLI environment too and use that environment when starting the process. - Language servers that are _not_ found in the CLI environment (or configured to not be found in there), will be spawned with the CLI environment in case that's set. That means users can do something like `RA_LOG=info zed .` and it will be picked up the rust-analyzer that was spawned. Demo/explanation: https://github.com/user-attachments/assets/455905cc-8b7c-4fc4-b98a-7e027d97cdfa
40 lines
724 B
TOML
40 lines
724 B
TOML
[package]
|
|
name = "cli"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
publish = false
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/cli.rs"
|
|
doctest = false
|
|
|
|
[[bin]]
|
|
name = "cli"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
clap.workspace = true
|
|
collections.workspace = true
|
|
ipc-channel = "0.18"
|
|
once_cell.workspace = true
|
|
parking_lot.workspace = true
|
|
paths.workspace = true
|
|
release_channel.workspace = true
|
|
serde.workspace = true
|
|
util.workspace = true
|
|
tempfile.workspace = true
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
exec.workspace = true
|
|
fork.workspace = true
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
core-foundation.workspace = true
|
|
core-services = "0.2"
|
|
plist = "1.3"
|