Skip to content

Repository files navigation

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

Debugging uses the Ruby LSP extension and the debug gem that SketchUp bundles. No debugger dll/dylib is needed, and nothing has to be installed into SketchUp — the launcher passes the debug bootstrap to SketchUp via its -RubyStartup command line switch. See DEBUGGING.md for the details, including how to debug extension startup.

Requires SketchUp 2024 or newer.

You also need to make sure you are loading the extension directly from your project's directory.

The short version:

  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 for debugging
  6. Pick the version of SketchUp to launch (e.g. 2026)
  7. Wait for SketchUp to launch.
  8. Go to the Debug tab in VSCode (Ctrl+Shift+D)
  9. Pick Attach to SketchUp in the drop-down.
  10. Click the Start Debugging button.

For SketchUp 2023 and older, use a commit from before this project dropped support for them. Those versions do not bundle the debug gem and need the SketchUp Ruby Debugger dll/dylib with the deprecated rebornix.ruby extension.

Further Reading

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

About

VSCode Project for SketchUp Extension Development

Topics

Resources

Stars

77 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages