I have installed VS Code and Peng Lv’s Ruby extension v 0.25.3. From a command prompt, I start SketchUp Make 2017 with this:
SketchUp -rdebug "ide port=7000 wait"
SketchUp starts, then blocks waiting for a connection. I then start the debugger in VS Code using this launch configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for rdebug-ide",
"type": "Ruby",
"request": "attach",
"cwd": "${workspaceRoot}",
"remoteHost": "127.0.0.1",
"remotePort": "7000",
"remoteWorkspaceRoot": "${workspaceRoot}"
}
]
}
SketchUp unblocks and runs normally. In the Ruby Console, I enter this code:
$LOAD_PATH << 'C:/ProgramData/Shared Documents/Ex Lumina/VSCode Projects/SketchUp Boilerplate/sketchup-extension-vscode-project/src'
load 'ex_hello_cube.rb'
This loads the example “hello cube” extension. The Create Cube Example
menu entry appears at the end of SketchUp’s Extensions
menu, and the extension runs correctly when I click on that entry.
If I change the code in the extension’s ex_hello_cube/main.rb
file and enter load 'ex_hello_cube/main.rb'
in the Ruby console, then run the extension again, my changes take effect.
However, if I add breakpoints to the code in VSCode, they are ignored when I run the extension. The red dots appear in VSCode’s gutter and the breakpoints are listed at the bottom the Debug sidebar.
In the Ruby console, I can also run this code:
require 'socket'
module MeMeMe
s = TCPSocket.new 'localhost', 7000
s.puts('break') # send a 'break command' to the SU debugger
line = s.gets # Read lines from socket
puts line # and print them
s.close # close socket when done
end
The above prints this result:
<breakpoints></breakpoints>
The VSCode debugger does stop at breakpoints in my Ruby programs that are not SketchUp extensions.
NOTE: I installed SURubyDebugger.dll into my SketchUp executable’s folder. I downloaded it from the releases page on GitHub. The notes at the actual repository state that I must use version 1.1.0.0 with VS Code. However, the Windows properties sheet for the version available at the releases page says it is version 1.0.2.0. I am unable to find a binary of version 1.1.0.0. If that’s the cause of my problem, then if anyone can direct me to a Windows 64-bit version 1.1.0.0 of SURubyDebugger.dll, I’d be most grateful.
I would also be very grateful for any other help in figuring out why the breakpoints aren’t having any effect in my SketchUp extensions.
Thanks.