vscode-ruby version: lastWhen i debug a simple code exit these output
Someone can help me?
Looks like you need to manually run gem install ruby-debug-ide on Windows. Note that ruby-debug-ide is a native gem that requires installed build tools.
Please follow https://github.com/rubyide/vscode-ruby#install-ruby-dependencies and make sure you can run ruby-debug-ide directly on your machine
I've got the same problem, @rebornix. I followed the latest instructions. Please tell me which information needs to be collected for assessment, and where that information is typically located, directory-wise.
x64 Win 10 Pro box
Visual Studio Code 1.11.2
vs-code Ruby 0.12.0
@the-nose-knows can you run rdebug-ide xx.rb directly in cmd? If you can do that, it might mean Code doesn't take your env, so you can try to launch VS Code from command line and debug again.
@rebornix
C:\WINDOWS\system32>rdebug-ide xx.rb
=> Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 127.0.0.1:1234
Is there an easier way to launch VS Code to take env without using command-line? I've got my taskbar pretty solid, and try to use command-line only when I actually need something that is command-line.
When using cmd.exe as my terminal inside of VS Code and using that command, this is the result:
C:\Users\this_user\Desktop\ruby_stuff>rdebug-ide xx.rb
Fatal exception in DebugThread loop: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) for "127.0.0.1" port 1234
Backtrace:
C:/Ruby22/lib/ruby/gems/2.2.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:110:ininitialize' from: C:/Ruby22/lib/ruby/gems/2.2.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:110:innew'
from: C:/Ruby22/lib/ruby/gems/2.2.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:110:in `block in start_control'
Any possible relation to this issue and documentation?
https://github.com/SpookyJS/SpookyJS/issues/71#issuecomment-24093894
https://nodejs.org/docs/v6.9.0/api/all.html#child_process_spawning_bat_and_cmd_files_on_windows
@the-nose-knows can you add showDebuggerOutput to your launch.json entry and tell me what's in the output channel?
The second issue you have is the port conflict, that's because you are trying to run rdebug-ide twice and both of the processes want to take port 1234
I need to know the key name and the expected value used. You'll have to tell me what precisely to set, and where, as it's not mentioned at these resources:
https://code.visualstudio.com/docs/extensionAPI/api-debugging
https://code.visualstudio.com/docs/extensions/debugging-extensions
I tried adding,
"showDebuggerOutput": "true"
and
"showDebuggerOutput": true
and didn't see any behavior difference after reloading VS Code.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local",
"type": "Ruby",
"request": "launch",
"program": "/c/Users/this_user/Desktop/ruby_stuff/first.rb",
"showDebuggerOutput": true
}
]
}
Additionally Googling +showDebuggerOutput +vscode doesn't show anything meaningful near the top; neither did +"showDebuggerOutput"
I also tried VS Code Insider 1.11.2 with the ruby extensions installed.
Sorry for that, our launch.json intellisense doesn't have a good discoverbility.

Add "showDebuggerOutput": true as above and take a look at the DEBUG CONSOLE (sorry for misleading you to output channel). A successful debugging session should generate what you can see above, so I'm willing to know what's the output on your machine.
Fixed!!!
My new launch.json:
{
"version": "0.2.0",
"debugServer":4711,
"configurations": [
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "{workspaceRoot}/../first.rb",
"showDebuggerOutput": true
}/*,
{
"name": "Debug Local",
"type": "Ruby",
"request": "launch",
"program": "/c/Users/this_user/Desktop/ruby_stuff/first.rb",
"showDebuggerOutput": true
}*/
]
}
What was I missing that was so important? The "debugServer", the "cwd"; something else? There might be an important VS Code documentation section on debugging that I shouldn't have skimmed; if so, any suggestions on specific articles to reference?
I'm afraid Code doesn't pass a good program value https://code.visualstudio.com/docs/editor/debugging#_variable-substitution to us so that's why we can't debug anything
Cool, @rebornix -- I'll drop the minimal JSON with working debugging here for future reference with this layout:
C:\Users\this_user\Desktop\ruby_stuff\my_script.rb C:\Users\this_user\Desktop\ruby_stuff\.vscode\launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "{workspaceRoot}/../my_script.rb",
"showDebuggerOutput": true
}
]
}
This might help someone: https://stackoverflow.com/questions/51722136/how-do-you-run-and-debug-ruby-on-rails-from-visual-studio-code/54477794#54477794 This worked for me
For all people hitting this error on Windows, despite adding PATH to ENV in launch.json, mind this: https://stackoverflow.com/a/54993121/717732 - check the spelling of PATH on your OS!
Most helpful comment
Looks like you need to manually run
gem install ruby-debug-ideon Windows. Note thatruby-debug-ideis a native gem that requires installed build tools.