From 73338554fb4af0932098aeb0e8e44ff55311c1cb Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Tue, 8 Sep 2026 19:30:02 +0200 Subject: [PATCH] fix(ruby): inject request types for debug requests Scenarios created from Zed's new debug session dialog omit the `request` field when converted to an rdbg configuration. The adapter later rejects that configuration because it cannot determine whether to launch or attach. Include the corresponding `launch` or `attach` request in generated scenarios so both flows reach the correct rdbg path. Closes https://github.com/zed-extensions/ruby/issues/324 --- src/ruby.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ruby.rs b/src/ruby.rs index 9c79613..8a53c0e 100644 --- a/src/ruby.rs +++ b/src/ruby.rs @@ -295,9 +295,13 @@ impl zed::Extension for RubyExtension { cwd: launch.cwd.clone(), }; - let config = serde_json::to_value(config) - .map_err(|e| e.to_string())? - .to_string(); + let mut config = serde_json::to_value(config).map_err(|e| e.to_string())?; + config + .as_object_mut() + .ok_or_else(|| "Failed to convert launch config into JSON object".to_string())? + .entry("request") + .or_insert("launch".into()); + let config = config.to_string(); Ok(DebugScenario { adapter: zed_scenario.adapter, @@ -317,9 +321,13 @@ impl zed::Extension for RubyExtension { cwd: None, }; - let config = serde_json::to_value(config) - .map_err(|e| e.to_string())? - .to_string(); + let mut config = serde_json::to_value(config).map_err(|e| e.to_string())?; + config + .as_object_mut() + .ok_or_else(|| "Failed to convert attach config into JSON object".to_string())? + .entry("request") + .or_insert("attach".into()); + let config = config.to_string(); Ok(DebugScenario { adapter: zed_scenario.adapter,