Skip to content

Latest commit

 

History

History
78 lines (48 loc) · 3.41 KB

File metadata and controls

78 lines (48 loc) · 3.41 KB

VSCode Project for SketchUp Extension Development

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.

Prerequisites

Getting started

  1. Clone the project to your machine.
  2. From the command line install the require gem dependencies: bundle install
  3. Start coding!

Configuration

You might want to review the various configuration files to fit your project needs:

.rubocop.yml

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.

.solargraph.yml

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.

.vscode/tasks.json

Add/remove task launchers for relevant SketchUp versions. Follow the pattern for the existing launchers.

.editorconfig

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.

How To

Debug in SketchUp

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:

  1. Set break points in the gutter bar next to the line numbers in the editor.
  2. View > Command Palette (Ctrl+Shift+P)
  3. Start typing task
  4. Pick Tasks: Run Task
  5. Pick Launch SketchUp in Ruby debug mode
  6. Pick the version of SketchUp to launch (e.g. 2022)
  7. Wait for SketchUp to launch.
  8. Go to the Debug tab in VSCode (Ctrl+Shift+D)
  9. Pick Listen for rdebug-ide in the drop-down.
  10. Click the Start Debugging button.

More details: https://github.com/SketchUp/sketchup-ruby-api-tutorials/wiki/VSCode-Debugger-Setup

Further Reading

For the latest information on setting up rubocop-sketchup integration with VSCode, refer to: