This is a boiler plate example project for setting up a VSCode project for SketchUp extension development.
Key features of this setup:
- When opening the project in VSCode you will be presented with a recommended set of VSCode extensions if you are missing any.
- Configured for Ruby auto-complete and code insight.
- SketchUp Ruby API supported in auto-complete.
- VSCode tasks for debugging Ruby source in SketchUp.
- Inline static analysis powered by RuboCop and RuboCop SketchUp.
- Standalone Ruby installed on your development system. See rubocop-sketchup manual for more details.
- The Bundler gem to manage gem dependencies.
- Clone the project to your machine.
- From the command line install the require gem dependencies:
bundle install
- Start coding!
You might want to review the various configuration files to fit your project needs:
Configure what RuboCop should look for when analyzing your project. There are comments inline in the configuration file offering some help with what is pre-configured. For more details refer to the rubocop-sketchup manual.
You might want to update the require_paths
to reflect one of your SketchUp installation paths to ensure Solargraph is able to provide full auto-complete for the SketchUp API.
Add/remove task launchers for relevant SketchUp versions. Follow the pattern for the existing launchers.
You might want to adjust this configuration file to suit your own coding style. This file is a generic config file supported by many code editors.
Note: Make sure you have installed the required debugger dll/dylib to enable debugging in SketchUp.
You also need to make sure you are loading the extension directly from your project's directory.
A visual guide is available in our tutorials repository.
The short version is condensed here:
- Set break points in the gutter bar next to the line numbers in the editor.
View > Command Palette
(Ctrl+Shift+P
)- Start typing
task
- Pick
Tasks: Run Task
- Pick
Launch SketchUp in Ruby debug mode
- Pick the version of SketchUp to launch (e.g.
2022
) - Wait for SketchUp to launch.
- Go to the Debug tab in VSCode (
Ctrl+Shift+D
) - Pick
Listen for rdebug-ide
in the drop-down. - Click the
Start Debugging
button.
More details: https://github.com/SketchUp/sketchup-ruby-api-tutorials/wiki/VSCode-Debugger-Setup
For the latest information on setting up rubocop-sketchup integration with VSCode, refer to: