feat(debugger): debug Ruby programs and tests with rdbg (#2173)

Ruby files, `rails server`, Rake tasks, RSpec and Minitest configurations
can be debugged with rdbg, using the project's Ruby. In a Bundler project
it runs through the bundle; if the bundle lacks the `debug` gem, debugging
stops with an error asking to add `gem "debug"` to the Gemfile.
Цей коміт міститься в:
Kerem Bozdas authored and GitHub committed 2026-11-09 01:41:27 +08:00
1 джерело c133d2dba9
коміт 75607c0bbf
12 files changed
+213 -7

No files matched your search

+1
Переглянути файл
@@ -64,6 +64,7 @@ const ADAPTERS: ReadonlyArray<{ id: string; label: string }> = [
{ id: "codelldb", label: "CodeLLDB (Rust, C, C++)" },
{ id: "lldb-dap", label: "lldb-dap (C, C++, Swift)" },
{ id: "php-debug", label: "php-debug (PHP)" },
{ id: "rdbg", label: "rdbg (Ruby)" },
];
/** Options "Modify options" adds to the form: value fields (shown once added) and flags (chips). */
+1
Переглянути файл
@@ -22,6 +22,7 @@ describe("Ruby file run", () => {
it("puts Sources roots on the load path", () => {
const p = produceContext(input("/work/app/test/integration/a_test.rb"), env);
expect(p?.config?.args).toEqual(["-Ilib", "test/integration/a_test.rb"]);
expect(p?.config?.debugAdapter).toBe("rdbg");
});
it("adds none for files outside the project", () => {
+8 -4
Переглянути файл
@@ -887,10 +887,14 @@ export function produceFile(input: ContextInput, env: ToolEnv): Produced | null
}
case "ruby":
// Sources roots go on the load path (`-Ilib`), as `rake test` does; paths are project-relative.
return simple(lang, s, env, lang, () => [
...(s.inProject ? rubyLoadPath(currentRoots(), s.cwd, input.root) : []),
s.arg,
]);
return simple(
lang,
s,
env,
lang,
() => [...(s.inProject ? rubyLoadPath(currentRoots(), s.cwd, input.root) : []), s.arg],
"rdbg",
);
case "php":
if (env.php) return { name: s.file, scope: "file", config: fileConfig(s, "php", env.php, [s.arg], "php-debug") };
return simple(lang, s, env, lang, () => [s.arg], "php-debug");