Skip to content

Ensure command args aren't parsed by rdbg#128

Merged
vitallium merged 1 commit into
zed-extensions:mainfrom
Hawkbawk:separate_rdbg_args
Jun 29, 2025
Merged

Ensure command args aren't parsed by rdbg#128
vitallium merged 1 commit into
zed-extensions:mainfrom
Hawkbawk:separate_rdbg_args

Conversation

@Hawkbawk
Copy link
Copy Markdown
Contributor

Ensure that all commands and arguments come after an options terminator, as heavily recommended by rdbg themselves. This ensures that rdbg doesn't attempt to parse and delete options that are meant for the program.

@cla-bot cla-bot Bot added the cla-signed label Jun 29, 2025
@Hawkbawk
Copy link
Copy Markdown
Contributor Author

More Context

Previously, the bare command and all of its arguments were being passed directly to rdbg, without any argument separation. For example, given the following debug config:

[
  {
      "request": "launch",
      "adapter": "rdbg",
      "label": "Launch Rails Server with Ruby extension (Debug)",
      "command": "bin/rails server -p 8000",
      "cwd": "${ZED_WORKTREE_ROOT}"
  },
]

The command /path/to/rdbg --open --host=2130706433 --port=55075 --command bin/rails server -p 8000 will be used to start the debugger. The issue here is that rdbg ends up parsing the -p 8000 as an argument to itself, rather than to rails. This means that you can't specify a port for Rails and the debugger will actually fail to launch, as it doesn't end up listening on the port that Zed is expecting.

Comment thread src/ruby.rs
arguments.push(command.clone());
arguments.extend(["--command".into(), "--".into(), command.clone()]);
} else if let Some(command_or_script) = &ruby_config.script_or_command {
if worktree.which(command_or_script).is_some() {
Copy link
Copy Markdown
Collaborator

@vitallium vitallium Jun 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought (non-blocking): I wonder why we need to check if command_or_script exists in a worktree here. We should check that later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, the requirement for command_or_script comes from the dap_config_to_scenario method. We aren't sure if what they're giving us is a script or a command, but we don't have access to the worktree in that method, so we forward it along and let the get_dap_binary deal with checking that. Agreed that we should investigate how necessary command_or_script is though.

@vitallium
Copy link
Copy Markdown
Collaborator

vitallium commented Jun 29, 2025

@Hawkbawk nice catch! I am happy to merge this but we have some merge conflicts here after #127. Would you mind resolving them? Thanks!

@Hawkbawk Hawkbawk force-pushed the separate_rdbg_args branch from ff40c5e to 1047379 Compare June 29, 2025 16:29
@Hawkbawk
Copy link
Copy Markdown
Contributor Author

Conflicts fixed! Thanks for looking at these.

@vitallium
Copy link
Copy Markdown
Collaborator

Conflicts fixed! Thanks for looking at these.

Thanks!

@vitallium vitallium merged commit b7453ac into zed-extensions:main Jun 29, 2025
3 checks passed
notpeter pushed a commit to zed-industries/extensions that referenced this pull request Jul 8, 2025
Hi, this pull request updates the Ruby extension from v0.10.1 to
[v0.12.0](https://github.com/zed-extensions/ruby/releases/tag/v0.12.0).
Here is the list of changes for each release:

## v0.12.0

```
What's Changed

feat(ruby): add gem uninstall functionality by @vitallium in zed-extensions/ruby#135
Add support for debug locators by @Hawkbawk in zed-extensions/ruby#130
feat(ruby): Add basic support for displaying dbg variables by @vitallium in zed-extensions/ruby#125
Add snippets by @andyw8 in zed-extensions/ruby#53
fix(rdbg): Improve debugger argument handling by @vitallium in zed-extensions/ruby#136
```

## v0.11.0

```
What's Changed

feat(rdbg): support RUBY_DEBUG env vars for host and port by @vitallium in zed-extensions/ruby#123
feat(rdbg): support attach requests for rdbg debugger by @vitallium in zed-extensions/ruby#124
Update Rust crate serde to v1.0.219 by @renovate in zed-extensions/ruby#116
Update Rust crate serde_json to v1.0.140 by @renovate in zed-extensions/ruby#117
Ensure cwd actually has a default by @Hawkbawk in zed-extensions/ruby#127
Ensure command args aren't parsed by rdbg by @Hawkbawk in zed-extensions/ruby#128
Support Rake outlines by @joeldrapper in zed-extensions/ruby#131
```

Thanks!
lucascompython pushed a commit to lucascompython/extensions that referenced this pull request Oct 3, 2025
Hi, this pull request updates the Ruby extension from v0.10.1 to
[v0.12.0](https://github.com/zed-extensions/ruby/releases/tag/v0.12.0).
Here is the list of changes for each release:

## v0.12.0

```
What's Changed

feat(ruby): add gem uninstall functionality by @vitallium in zed-extensions/ruby#135
Add support for debug locators by @Hawkbawk in zed-extensions/ruby#130
feat(ruby): Add basic support for displaying dbg variables by @vitallium in zed-extensions/ruby#125
Add snippets by @andyw8 in zed-extensions/ruby#53
fix(rdbg): Improve debugger argument handling by @vitallium in zed-extensions/ruby#136
```

## v0.11.0

```
What's Changed

feat(rdbg): support RUBY_DEBUG env vars for host and port by @vitallium in zed-extensions/ruby#123
feat(rdbg): support attach requests for rdbg debugger by @vitallium in zed-extensions/ruby#124
Update Rust crate serde to v1.0.219 by @renovate in zed-extensions/ruby#116
Update Rust crate serde_json to v1.0.140 by @renovate in zed-extensions/ruby#117
Ensure cwd actually has a default by @Hawkbawk in zed-extensions/ruby#127
Ensure command args aren't parsed by rdbg by @Hawkbawk in zed-extensions/ruby#128
Support Rake outlines by @joeldrapper in zed-extensions/ruby#131
```

Thanks!
kumamaki pushed a commit to kumamaki/zed-extensions that referenced this pull request May 5, 2026
Hi, this pull request updates the Ruby extension from v0.10.1 to
[v0.12.0](https://github.com/zed-extensions/ruby/releases/tag/v0.12.0).
Here is the list of changes for each release:

## v0.12.0

```
What's Changed

feat(ruby): add gem uninstall functionality by @vitallium in zed-extensions/ruby#135
Add support for debug locators by @Hawkbawk in zed-extensions/ruby#130
feat(ruby): Add basic support for displaying dbg variables by @vitallium in zed-extensions/ruby#125
Add snippets by @andyw8 in zed-extensions/ruby#53
fix(rdbg): Improve debugger argument handling by @vitallium in zed-extensions/ruby#136
```

## v0.11.0

```
What's Changed

feat(rdbg): support RUBY_DEBUG env vars for host and port by @vitallium in zed-extensions/ruby#123
feat(rdbg): support attach requests for rdbg debugger by @vitallium in zed-extensions/ruby#124
Update Rust crate serde to v1.0.219 by @renovate in zed-extensions/ruby#116
Update Rust crate serde_json to v1.0.140 by @renovate in zed-extensions/ruby#117
Ensure cwd actually has a default by @Hawkbawk in zed-extensions/ruby#127
Ensure command args aren't parsed by rdbg by @Hawkbawk in zed-extensions/ruby#128
Support Rake outlines by @joeldrapper in zed-extensions/ruby#131
```

Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants