- Install Ruby+Devkit from rubyinstaller.org/downloads
- Install Visual Studio Code at code.visualstudio.com
- Navigate in PowerShell to the directory you have your Ruby project folder in and run
gem install ruby-debug-ide
.
PS C:\Users\Administrator\Source> gem install ruby-debug-ide
Fetching ruby-debug-ide-0.7.3.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed ruby-debug-ide-0.7.3
Parsing documentation for ruby-debug-ide-0.7.3
Installing ri documentation for ruby-debug-ide-0.7.3
Done installing documentation for ruby-debug-ide after 1 seconds
1 gem installed
PS C:\Users\Administrator\Source>
- Open Visual Studio Code and install the Ruby plugin by Peng Lv.
- Once you have opened your project folder in Visual Studio Code, open one of your Ruby project files. Classic_jazz.rb, for example.
- Click on Visual Studio Code’s debug menu at the left and choose “create a launch.json file” and choose Ruby and then Debug Local File. Then, delete the contents of the file and paste in what you see below and replace the name of the file you want to debug in the program value. The file I was debugging was called classic_jazz.rb.
{
// 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": "Debug Local File",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/classic_jazz.rb",
"cwd": "${workspaceRoot}"
}
]
}
That’s it! Thank you for reading this blog post!