vscode-rdbg icon indicating copy to clipboard operation
vscode-rdbg copied to clipboard

Automatically attach to debugger from terminal command.

Open mstate opened this issue 2 years ago • 1 comments

Rather than launching an RSpec test with a launch configuration, I would rather use an RSpec extension which provides enhanced RSpec functionality (currently using Ruby Spec Runner). When I launch and RSpec test using an extension , is there a way to have VSCode automatically attach to the rdbg session? Currently, I have to skip the --nonstop and manually Attach to rdbg each time I run.

E.g. Extension runs the command: bundle exec rdbg -O -c -- rspec -f p -f j --out '/tmp/tmp-729-r4igLURiplE4-.json' '/spec/controllers/my_controller_spec.rb:61'

What I would like is to run rdbg with --nonstop and have it automatically connect to vscode to pickup any breakpoints set.

Note: When I tried to add --open vscode it opens a new VSCode window.

mstate avatar Feb 14 '23 14:02 mstate

Sorry I can not understand the situation.

I understand:

  • You want to run rspec with Ruby Spec Runner
  • You want to attach to the rspec processes automatically

I can not understand:

  • What is "automatically"?
  • "Currently, I have to skip the --nonstop " what skips?

Maybe

What I would like is to run rdbg with --nonstop and have it automatically connect to vscode to pickup any breakpoints set. is key but I couldn't understand what do you want to do.

My guess:

  • Run rspec with options on rdbg with -O
  • And attach VSCode, setup breakpoints (marked on VSCode editor) and continue until the breakpoint
  • And stop at the breakpoint which setup on VSCode

are right?

  1. At first, I'm not sure about "Ruby Spec Runner".
  2. Maybe you can run rspec -f p -f j --out '/tmp/tmp-729-r4igLURiplE4-.json' '/spec/controllers/my_controller_spec.rb:61' command line on "Debug command line" dialog with askParameters.
  3. But maybe you don't want to put it on the dialog. Another way is modify .vscode/launch.json and setup command, args and run debug session (F5).

I guess you hope "Ruby Spec Runner" kicks the above steps automatically but I'm not sure how to collaborate with it. Introducing new command (kick debug session with given parameter) is acceptable, but maybe "Ruby Spec Runner" can kick debug session with the above parameters.

ko1 avatar Mar 07 '23 16:03 ko1