vscode-ruby version: 0.6.1Putting the following configuration in launch.json
{
"name": "RSpec - active spec file only",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "../.rbenv/shims/rspec",
"args": ["${file}"]
},
Should allow me to run my spec file like it runs at the terminal
rspec bash program is opened as if it is the ruby script to be ran, and since it's a bash script and not a ruby script, I get an error that shows a syntax error in the ruby bash script.
< The following is the error message which just shows the first few lines of the rspec bash program's code where it thinks it's getting a syntax error because I guess it thinks it's supposed to open the file and not run it as a program. >
Uncaught exception: /Users/
[ -n "$RBENV_DEBUG" ] && set -x
^
/Users/
[ -n "$RBENV_DEBUG" ] && set -x
1) install rbenv
2) install ruby 2.4.1 using rbenv
3) setup a launcher with the configuration pasted above in the expected behavior in VS Code's launch.json file.
4) create a spec file to run
5) go into debug mode on VS Code
6) select the launcher you just created (RSpec - active spec file only)
7) Press the green arrow to Debug the spec file using the launcher.
Looks like this is an issue with how rbenv switches ruby versions. rbenv creates a shim directory, and in it, somehow creates a pointer type file to the correct version of rspec, by not using the rspec file in the shim directory, but instead, using the rspec file in the
@atracy Could you share your updated config to show what the updated program property looks like?
@degoeym change:
"pathToBundler": "${env:HOME}/.rbenv/shims/bundle",
to:
"pathToBundler": "${workspaceRoot}/bin/bundle",,
Most helpful comment
@degoeym change:
"pathToBundler": "${env:HOME}/.rbenv/shims/bundle",to:
"pathToBundler": "${workspaceRoot}/bin/bundle",,