From 8d0fff688f54c6dd2626e292f296eb9753f10c0f Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Fri, 12 Dec 2025 00:47:40 +0100 Subject: [PATCH] rust: Change cwd of `cargo run`-esque tasks to use package root, not dirname of current file as cwd (#44672) This also applies to `cargo clean` one. Closes #20873 Release Notes: - rust: Changed cwd of tasks that spawn a binary target to the root of a current package (which used to be a directory of the current source file). --- crates/languages/src/rust.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index 31d7448285969fbce005b9b7134f56c7d8362f73..aadf882b8eb038f49b5ad602ba074a91e20ed78d 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -882,7 +882,7 @@ impl ContextProvider for RustContextProvider { RUST_BIN_REQUIRED_FEATURES_FLAG_TASK_VARIABLE.template_value(), RUST_BIN_REQUIRED_FEATURES_TASK_VARIABLE.template_value(), ], - cwd: Some("$ZED_DIRNAME".to_owned()), + cwd: Some(RUST_MANIFEST_DIRNAME_TASK_VARIABLE.template_value()), tags: vec!["rust-main".to_owned()], ..TaskTemplate::default() }, @@ -904,14 +904,14 @@ impl ContextProvider for RustContextProvider { label: "Run".into(), command: "cargo".into(), args: run_task_args, - cwd: Some("$ZED_DIRNAME".to_owned()), + cwd: Some(RUST_MANIFEST_DIRNAME_TASK_VARIABLE.template_value()), ..TaskTemplate::default() }, TaskTemplate { label: "Clean".into(), command: "cargo".into(), args: vec!["clean".into()], - cwd: Some("$ZED_DIRNAME".to_owned()), + cwd: Some(RUST_MANIFEST_DIRNAME_TASK_VARIABLE.template_value()), ..TaskTemplate::default() }, ];