@smilence
2020-03-07T13:27:58.000000Z
字数 1956
阅读 1285
Ruby
SDE-Foundations
Ruby
in Extensions Marketplace in and install that (the 5th icon in left vertical bar) gem install ruby-debug-ide
in any terminal
{
// 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": "RSpec - active spec file only",
"type": "Ruby",
"request": "launch",
"program": "/usr/local/bin/rspec",
"args": ["${file}"],
},
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd":"${workspaceRoot}",
"program": "${file}"
},
]
}
{
"launch": {
// 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 RSpec",
"type": "Ruby",
"request": "launch",
"program": "/Users/april/.rbenv/shims/rspec",
"args": [
"${file}"
],
},
{
"name": "Debug Ruby",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${file}"
},
{
"type": "node",
"request": "launch",
"name": "Debug JavaScript",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
],
"window.zoomLevel": 2
},
"editor.fontFamily": "FiraCode-Retina",
"editor.fontLigatures": true,
"window.zoomLevel": 3,
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true
}
The above steps you only have to do it once, next time you can just select the config "Debug Local File" or from dropdown menu when you open the launch.json
5. Add a breakpoint somewhere in your ruby file (click on the left of the line you want to start debugging with, and there will be red dot), Open the ruby / Rspec file you want to debug on, and then click on the bug icon on left bar
6. Make sure your code has an example rather than just definition, such as p foo()
, and then click on the green arrow next to "DEBUG AND RUN" or press F5. Then you can start doing things like "next" "step" "continue"