connorshea / vscode-ruby-test-adapter

A Ruby test adapter extension for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=connorshea.vscode-ruby-test-adapter
MIT License
83 stars 50 forks source link

Use bundler to start debugger when configured in workspace #59

Closed jochenseeber closed 3 years ago

jochenseeber commented 3 years ago

When debugging a Ruby Gem unit test, the debugger uses the wrong load path. E.g. when the Gem is already installed, the installed version is used instead of the version in the local development directory.

This patch prepends a "bundle exec" when starting the debugger if the Ruby workspace is configured to use bundler (setting "ruby.useBundler"

connorshea commented 3 years ago

Technically, the useBundler setting should be defined by the Ruby Test Explorer rather than using the one defined by the Ruby extension for VS Code. This extension can be used with or without that extension.

I'd prefer that as a solution over borrowing the ruby.useBundler setting.

jochenseeber commented 3 years ago

Changed it provide a debuggerCommand setting, similar to rspecCommand and minitestCommand.

I would still suggest (as a future extension) not hardcoding the default to use "bundle exec" for all the commands, but fall back to the Ruby extensions' ruby.useBundler, if present. The number of people using this extension without the Ruby extensions is probably minuscule, and it would be nice to have a "global" useBundler setting instead of having to go through all configurations of all plugins to change individual settings. The individual settings should only have to be changed to override the global setting.

However, a better solution would be of course a separate patch that does this for all commands of this extension. If acceptable, I volunteer...