ZIm/crates/project/src
Thorsten Ball 0360cda543
tasks: Use environment variables from project (#15266)
This fixes #12125 and addresses what's described in here:

-
https://github.com/zed-industries/zed/issues/4977#issuecomment-2162094388

Before the changes in this PR, when running tasks, they inherited the
Zed process environment, but that might not be the process environment
that you'd get if you `cd` into a project directory.

We already ran into that problem with language servers and we fixed it
by loading the shell environment in the context of a projects root
directory and then passing that to the language servers when starting
them (or when looking for their binaries).

What the change here does is to add the behavior for tasks too: we use
the project-environment as the base environment with which to spawn
tasks. Everything else still works the same, except that the base env is
different.

Release Notes:

- Improved the environment-variable detection when running tasks so that
tasks can now access environment variables as if the task had been
spawned in a terminal that `cd`ed into a project directory. That means
environment variables set by `direnv`/`asdf`/`mise` and other tools are
now picked up.
([#12125](https://github.com/zed-industries/zed/issues/12125)).

Demo:


https://github.com/user-attachments/assets/8bfcc98f-0f9b-4439-b0d9-298aef1a3efe
2024-07-26 18:19:53 +02:00
..
lsp_command Tidy up collab-related signature help data (#14377) 2024-07-13 04:06:01 +03:00
buffer_store.rs Make git blame for SSH remote projects (#15106) 2024-07-24 15:50:29 -07:00
connection_manager.rs Handle buffer diff base updates and file renames properly for SSH projects (#14989) 2024-07-23 11:32:37 -07:00
debounced_delay.rs Handle buffer diff base updates and file renames properly for SSH projects (#14989) 2024-07-23 11:32:37 -07:00
lsp_command.rs lsp: Check if "Goto Definition" supported before request (#15111) 2024-07-24 23:28:23 +03:00
lsp_ext_command.rs lsp: Revert URL type change (#13193) 2024-06-18 12:39:56 +02:00
prettier_support.rs Allow user to use multiple formatters (#14846) 2024-07-23 20:05:09 +02:00
project.rs tasks: Use environment variables from project (#15266) 2024-07-26 18:19:53 +02:00
project_settings.rs Use US English spelling of "behavior" and "customize" (#15117) 2024-07-24 16:36:01 -04:00
project_tests.rs Make git blame for SSH remote projects (#15106) 2024-07-24 15:50:29 -07:00
search.rs util: Use GlobSet in PathMatcher (#13197) 2024-06-18 16:12:24 +02:00
search_history.rs project search: Persist search history across session (#9932) 2024-04-02 11:13:18 +02:00
task_inventory.rs chore: Clippy fixes for 1.80 (#13987) 2024-07-10 17:53:17 +02:00
terminals.rs Extend task templates with shell and hide fields to use custom shells and custom close behavior (#15031) 2024-07-23 22:58:36 +03:00
worktree_store.rs regression: Fix a panic when removing git-containing worktree from the project panel (#15256) 2024-07-26 14:20:59 +03:00
yarn.rs Add support for projects managed with Yarn (#13644) 2024-07-11 14:56:07 +02:00