How to improve the debug efficiency using Ruby code editor

It is no very easy to program in Ruby code editor, especially when debugging.

Is there any other code and debug tools which are better than ruby code editor in second development of SU.

When you say “Ruby code editor”, are you referring to the Ruby Console in SketchUp?

In the SketchUp Ruby API documentation overview ( there are links to debugger tools. From there it describe how to set up Ruby debugging using RubyMine or VSCode.

We also have a bare minimum VSCode example project set up for debugging:

1 Like

I haven’t solved the above problem with the vscode ,

  1. I am not quite clear the “project” directory.
    Is the directory ?
    c:\user\addsummsun or as follows:
    c:\Users\addsummsun\AppData\Roaming\SketchUp\SketchUp 2018\SketchUp\Plugins

2.what’s the meaning of " #{SOURCE} "

3.I have tested the ENV[“HOME”] which maybe infer to "c:\user\addsummsun " , addsummsun is my user name.

4.How do I put the minimum example in my directory?

Many Thanks!

Yes this is true. The user’s "HOME" directory (Unix, Mac) is the same as the "USERPROFILE" directory on MS Windows. The "HOME" environment variable had to be defined by SketchUp on Windows because Ruby needs it to expand "~" in path strings to ENV["HOME"] in the File.expand_path method.

The project directory will likely be where you set up a code repository (if using GitHub.)

Consider your code to be documents and independent of the SketchUp version.

So the best place is probably beneath your "C:/users/addsummsun/documents/projects/" path.
Create a subdirectory there for each project.

This is the versioned SketchUp plugins directory path. This is where finished extensions are installed from RBZ zip archives.

But while in testing and development, you can put a small script there to load your code from the project location.

SEE: GitHub - SketchUp/sketchup-ruby-api-tutorials: SketchUp Ruby API Tutorials and Examples

Be specific. What URL, file and line ?

1 Like