Ruby

Summary

Basic

Spec

Instruction

install some gems https://github.com/rubyide/vscode-ruby/wiki/1.-Debugger-Installation

install extension.

If you use Ubuntu 18.04, it needs sudo apt install libruby ruby-dev.

module code

debug Unix Test

test/unit

test code

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug test/unit",
      "type": "Ruby",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "program": "${workspaceFolder}/test_bubble_sort.rb",
      "args": ["--name=test_bubble_sort"]
    }
  ]
}

debug executable script

code

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug execute File",
      "type": "Ruby",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "program": "${workspaceFolder}/bin.rb"
    }
  ]
}

debug remote process

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug remote",
      "type": "Ruby",
      "request": "attach",
      "cwd": "${workspaceFolder}",
      "remoteHost": "192.168.1.24",
      "remotePort": "1234",
      "remoteWorkspaceRoot": "/home/nnyn/vscode-debug-specs/ruby"
    }
  ]
}

how to

  1. start remote process
rdebug-ide --host 0.0.0.0 --port 1234 -- bin/bin.rb
  1. start vscode debugger