Parse env vars and args from debug launch editor (#30538)

Release Notes:

- debugger: allow setting env vars and arguments on the launch command.

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Julia Ryan
2025-05-12 09:44:17 +00:00
committed by GitHub
co-authored by Cole Miller Conrad Irwin
parent 0ad582eec4
commit 907b2f0521
11 changed files with 53 additions and 13 deletions
+11
View File
@@ -93,6 +93,17 @@ pub struct LaunchRequest {
pub env: FxHashMap<String, String>,
}
impl LaunchRequest {
pub fn env_json(&self) -> serde_json::Value {
serde_json::Value::Object(
self.env
.iter()
.map(|(k, v)| (k.clone(), v.to_owned().into()))
.collect::<serde_json::Map<String, serde_json::Value>>(),
)
}
}
/// Represents the type that will determine which request to call on the debug adapter
#[derive(Deserialize, Serialize, PartialEq, Eq, JsonSchema, Clone, Debug)]
#[serde(rename_all = "lowercase", untagged)]