debugging a ruby 2.7 program in VS Code using the ruby extension
Suppose you try to debug a ruby 2.7 program in VS Code using the ruby extension and get this error
Debugger terminal error: Process failed: spawn rdebug-ide ENOENT
Install some gems, ruby-debug-ide and debase
gem install ruby-debug-ide
gem install debase
Go to edit launch.json
in the directory containing the file you're debugging. I found the program
attribute had to be edited.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Ruby: Local File",
"type": "Ruby",
"request": "launch",
"program": "${file}"
}
]
}
Now change to a tab with a ruby file open and press F5, the debugger should run the file successfully!