From c43dba103bf330d359b0ae9f06a6000ba000c6ca Mon Sep 17 00:00:00 2001 From: Fredrik Enestad Date: Wed, 4 Feb 2026 18:20:50 +0100 Subject: [PATCH] project: Make individual DAP settings optional (#43647) Currently, when overriding e.g a `binary` in dap settings, one have to override all settings, including `args` as it otherwise set it to empty string. E.g this config will set `args` and `env` to their empty states, like empty string and empty map: ```json { "dap": { "Delve": { "binary": "/path/to/binary" } } } ``` This PR changes so that it is instead possible to only override a single field. This is useful e.g on nixos where you don't want (or cant let) zed download binaries for you, but you want to use the default args, such as in Delve, you want zed to configure it with a random listening port. Release Notes: - Improved dap settings so that it is possible to override individual fields, such as `binary` --- crates/project/src/debugger/dap_store.rs | 4 ++-- crates/project/src/project_settings.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs index 5868083d91208f910f7fba388b2c2f7f9009c1ba..90d77347767708a50f1a136c2daf7c41d930c983 100644 --- a/crates/project/src/debugger/dap_store.rs +++ b/crates/project/src/debugger/dap_store.rs @@ -268,8 +268,8 @@ impl DapStore { Some(worktree.read(cx).resolve_executable_path(path)) } }); - let user_args = dap_settings.map(|s| s.args.clone()); - let user_env = dap_settings.map(|s| s.env.clone()); + let user_args = dap_settings.and_then(|s| s.args.clone()); + let user_env = dap_settings.and_then(|s| s.env.clone()); let delegate = self.delegate(worktree, console, cx); diff --git a/crates/project/src/project_settings.rs b/crates/project/src/project_settings.rs index 4e0b176b7d5da949422fb130f1e3317c12dddfd0..4e9c1c76f1b15adb3ecb5b590d6a4f58e1704017 100644 --- a/crates/project/src/project_settings.rs +++ b/crates/project/src/project_settings.rs @@ -1495,8 +1495,8 @@ pub fn local_settings_kind_to_proto(kind: LocalSettingsKind) -> proto::LocalSett #[derive(Debug, Clone)] pub struct DapSettings { pub binary: DapBinary, - pub args: Vec, - pub env: HashMap, + pub args: Option>, + pub env: Option>, } impl From for DapSettings { @@ -1505,8 +1505,8 @@ impl From for DapSettings { binary: content .binary .map_or_else(|| DapBinary::Default, |binary| DapBinary::Custom(binary)), - args: content.args.unwrap_or_default(), - env: content.env.unwrap_or_default(), + args: content.args, + env: content.env, } } }