Fix ruby debugger (#32407)

Closes #ISSUE

Release Notes:

- debugger: Fix Ruby (was broken by #30833)

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
Conrad Irwin 2025-06-09 16:11:24 -06:00 committed by GitHub
parent b103d7621b
commit 3dfbd9e57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 116 additions and 174 deletions

View file

@ -530,6 +530,21 @@ impl EnvVariableReplacer {
fn new(variables: HashMap<VsCodeEnvVariable, ZedEnvVariable>) -> Self {
Self { variables }
}
fn replace_value(&self, input: serde_json::Value) -> serde_json::Value {
match input {
serde_json::Value::String(s) => serde_json::Value::String(self.replace(&s)),
serde_json::Value::Array(arr) => {
serde_json::Value::Array(arr.into_iter().map(|v| self.replace_value(v)).collect())
}
serde_json::Value::Object(obj) => serde_json::Value::Object(
obj.into_iter()
.map(|(k, v)| (self.replace(&k), self.replace_value(v)))
.collect(),
),
_ => input,
}
}
// Replaces occurrences of VsCode-specific environment variables with Zed equivalents.
fn replace(&self, input: &str) -> String {
shellexpand::env_with_context_no_errors(&input, |var: &str| {