Few days ago I found at Github very interesting repo by Ruby core team - ruby/debug: Debugging functionality for Ruby. I used it in my pet-project, and it works awesome! Also I found out that it is included in Rails 7 app template by default. So I think this debugger is really strong opponent to rebornix.ruby
extension and debugger which dont have new releases from 2021.
Contents below is short guide how to setup it fast.
Requirements
- Ruby installed through .rbenv or asdf
- Bundler gem
- VS Code
Setup Guide
- Create
.ruby-version
file in root of project if it not already exists.
$ echo "3.0.2" > .ruby-version
- Append to
Gemfile
group :development, :test do
gem "debug", platforms: %i[ mri mingw x64_mingw ]
end
- Run in terminal
$ bundler binstubs debug bundler
Install extension
Copy to
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Start rails server",
"type": "rdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"command": "",
"script": "${workspaceFolder}/bin/rails",
"useBundler": true,
"pathToBundler": "${workspaceFolder}/bin/bundle",
"rdbgPath": "${workspaceFolder}/bin/rdbg",
"args": ["s"],
}
]
}
Thats all! Open Run & Debug
panel & start debugging!
If you want to boost your VS Code editor for Ruby, you can also check my guide - Complete Guide to setup VS Code for Ruby on Rails (Debugger, Linter, Completion, Formatting)
Thank you for reading, I hope this article was helpful for you!
Top comments (0)