Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix `PythonLocator` to pass through `env` variables from the task template (#63154)

Andrey Fedoseev49a841c7ad42
diff --git a/crates/project/src/debugger/locators/python.rs b/crates/project/src/debugger/locators/python.rs
index 87219e4f8ca..51d8aad3509 100644
--- a/crates/project/src/debugger/locators/python.rs
+++ b/crates/project/src/debugger/locators/python.rs
@@ -67,7 +67,8 @@ impl DapLocator for PythonLocator {
"request": "launch",
"python": command,
"args": args,
- "cwd": build_config.cwd.clone()
+ "cwd": build_config.cwd.clone(),
+ "env": build_config.env.clone(),
});
if let Some(config_obj) = config.as_object_mut() {
if let Some(module) = mod_name {
diff --git a/crates/project/tests/integration/debugger.rs b/crates/project/tests/integration/debugger.rs
index ef0671f3056..d6d3816a10b 100644
--- a/crates/project/tests/integration/debugger.rs
+++ b/crates/project/tests/integration/debugger.rs
@@ -241,6 +241,7 @@ mod go_locator {
}
mod python_locator {
+ use collections::HashMap;
use dap::{DapLocator, adapters::DebugAdapterName};
use serde_json::json;
@@ -254,7 +255,11 @@ mod python_locator {
label: "run module '$ZED_FILE'".into(),
command: "$ZED_CUSTOM_PYTHON_ACTIVE_ZED_TOOLCHAIN".into(),
args: vec!["-m".into(), "$ZED_CUSTOM_PYTHON_MODULE_NAME".into()],
- env: Default::default(),
+ env: {
+ let mut env = HashMap::default();
+ env.insert("PYTHON_ENV".to_string(), "production".to_string());
+ env
+ },
cwd: Some("$ZED_WORKTREE_ROOT".into()),
use_new_terminal: false,
allow_concurrent_runs: false,
@@ -279,6 +284,7 @@ mod python_locator {
"args": [],
"cwd": "$ZED_WORKTREE_ROOT",
"module": "$ZED_CUSTOM_PYTHON_MODULE_NAME",
+ "env": { "PYTHON_ENV": "production" },
}),
tcp_connection: None,
};