dap: Allow user to pass custom envs to adapter via project settings (#40490)

It is now possible to configure logging level of CodeLLDB adapter via
envs specified in project settings like so:

```
{
    "dap": {
        "CodeLLDB": {
            "envs": {
                "RUST_LOG": "debug"
            }
        }
    }
}
```

Release Notes:

- N/A
This commit is contained in:
Jakub Konka
2025-10-17 16:48:00 +00:00
committed by GitHub
parent c1e87c8a00
commit 73e028c01c
13 changed files with 62 additions and 19 deletions
+9 -1
View File
@@ -264,13 +264,21 @@ impl DapStore {
DapBinary::Custom(binary) => Some(PathBuf::from(binary)),
});
let user_args = dap_settings.map(|s| s.args.clone());
let user_env = dap_settings.map(|s| s.env.clone());
let delegate = self.delegate(worktree, console, cx);
let cwd: Arc<Path> = worktree.read(cx).abs_path().as_ref().into();
cx.spawn(async move |this, cx| {
let mut binary = adapter
.get_binary(&delegate, &definition, user_installed_path, user_args, cx)
.get_binary(
&delegate,
&definition,
user_installed_path,
user_args,
user_env,
cx,
)
.await?;
let env = this
+2
View File
@@ -1215,6 +1215,7 @@ pub fn local_settings_kind_to_proto(kind: LocalSettingsKind) -> proto::LocalSett
pub struct DapSettings {
pub binary: DapBinary,
pub args: Vec<String>,
pub env: HashMap<String, String>,
}
impl From<DapSettingsContent> for DapSettings {
@@ -1224,6 +1225,7 @@ impl From<DapSettingsContent> for DapSettings {
.binary
.map_or_else(|| DapBinary::Default, |binary| DapBinary::Custom(binary)),
args: content.args.unwrap_or_default(),
env: content.env.unwrap_or_default(),
}
}
}