Repository navigation
How to debug Ruby using VS Code
If using VS Code, all you have to do is install the Ruby LSP extension to get the extra features in the editor.
The Ruby LSP is an implementation of the language server protocol for Ruby, used to improve rich features in editors. It is a part of a wider goal to provide a state-of-the-art experience to Ruby developers using modern standards for cross-editor features, documentation and debugging.
Even with the Ruby LSP guide for VS Code stating that you do not necessarily need to install the ruby-lsp gem manually, I found it a lot quicker for the Ruby LSP server to initialize when the ruby-lsp gem is installed upfront using
gem install ruby-lspFor some development work on the Bolt integration plugin for Foreman I personally have chosen to use an Ubuntu-based devcontainer in order to install all the required prerequisites in a self-contained environment.
In order to aquire the proper versions of NPM and Ruby using mise is a good idea, e.g. my Containerfile looks like this
ARG UBUNTU_VERSION=24.04
FROM ubuntu:${UBUNTU_VERSION}
ENV NODE_VERSION=22
ENV RUBY_VERSION=3.2
...
ADD --chmod=+x https://github.com/jdx/mise/releases/download/v2026.11.9/mise-v2026.11.9-linux-x64 /usr/local/bin/mise
USER ubuntu
RUN mise use -g node@${NODE_VERSION} ruby@${RUBY_VERSION} && \
echo 'eval $(mise activate)' > ~/.bash_profile && \
. ~/.bash_profile && \
npm install -g npm && \
gem install ruby-lsp
WORKDIR /workAfter cloning the foreman and foreman_openbolt repositories I had to create bundler.d/foreman_openbolt.rb with following content inside my working copy of foreman
gem 'foreman_openbolt', :path => '../foreman_openbolt'
gem 'debug'Afterwards Ruby and NPM dependencies are installled using following commands inside the working copy of foreman
bundler config set --local path vendor
bundler install
npm installIn order to start Foreman for debugging you can use following command
bundler exec rdbg -O -n -c -- foreman startMy .vscode/launch.json for attaching to the Ruby debugger or launching a Firefox instance for debugging looks like this
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Ruby debugger",
"type": "ruby_lsp",
"request": "attach"
},
{
"name": "Launch Firefox",
"type": "firefox",
"request": "launch",
"url": "http://localhost:5000",
"pathMappings": [
{
"url": "webpack://foreman_openbolt/src",
"path": "${workspaceFolder}/foreman_openbolt/webpack/src/"
}
]
}
]
}The Attach to Ruby debugger configuration enables debugging of Ruby code while the Launch Firefox configuration enables debugging of the frontend code.
- Ruby LSP: https://shopify.github.io/ruby-lsp
- Ruby LSP on GitHub: https://github.com/Shopify/ruby-lsp
- Ruby LSP on Marketplace: https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp
- Debugger for Firefox on Marketplace: https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug
- Technical Steering
- How OpenVox builds work
- OpenVox Release Playbook
- Adding support for new platforms
- Build Status
- The Tangled Web of OpenVox Clojure Project Dependencies
- OpenVox 9 Release Planning
- OpenVox 10 Release Planning
- Metrics and tracing overhaul
- Guides
Now located at community-triage/wiki
Create sub-issues on these