Daniel
Daniel

Reputation: 2531

Debugging (Old) Ruby Rack via VsCode

I been task to update an old ruby (2.4.10) project. The project is a simple API server written using Cuba and Rack. (Note that the project uses dep).

I'm trying to setup a working environment on my mac (using rbenv) and would like to debug the API server via VsCode. After hours of searching and testing all sort of launch.json configuration I came up empty.

I have created the most minimal representation of the project in at the following repo https://github.com/dannyhuly/ruby-rack.

Any help would be greatly appreciated.

FYI I'm a ruby newbie and would like to learn as mach as I can. So any additional information and suggestions would be greatly appreciated as well.

Upvotes: 0

Views: 336

Answers (1)

mper
mper

Reputation: 301

I ran a debug session with your project using the Ruby extension.

As explained in the vscode-ruby debugger docs, first I had to install the ruby-debug-ide and the debase gems.

Then I used the following launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Rack",
      "type": "Ruby",
      "request": "launch",
      "program": "~/.rbenv/versions/2.4.10/bin/rackup",
      "args": []
    }
  ]
}

If there's any issue starting the session, you should be able to see error logs in the debug console panel in VSCode.

Upvotes: 1

Related Questions