OpenSCAD for VS Code
Edit OpenSCAD files with all the luxuries of VSCode! Works with OpenSCAD v2019.05.
Project is available at: https://github.com/Antyos/vscode-openscad
This extension builds upon the "scad" extension by
Erik Benson and later expanded upon by GitHub user
This extension features:
- Syntax highlighting for
- Built-in OpenSCAD and user modules/functions
- Includes customizer syntax support for Drop down boxes, Sliders, and Tabs
- Built-in access to the OpenSCAD cheatsheet
|VSCode with OpenSCAD Plugin
Highlights customizer keywords in comments! As of OpenSCAD v2019.5, OpenSCAD itself does not currently do this.
Launch the built-in OpenSCAD cheatsheet with the command
Open OpenSCAD Cheatsheet or with the button in the status bar!
Make sure you have installed OpenSCAD here: https://www.openscad.org/downloads.html
.scad file in both VSCode and in OpenSCAD.
In OpenSCAD, make sure to have
Automatic Reload and Preview checked under
Design > Automatic Reload and Preview. You may also want to hide the editor and customizer panels in OpenSCAD by checking
View > Hide Editor and
View > Hide Customizer.
When you save your file in VSCode, it will automatically reload and preview in OpenSCAD.
For more information, see: Using an external Editor with OpenSCAD
Code Runner support
Until previewing is built into this extension, you can use Code Runner by formulahendry. To add support support for Code Runner, add the following to your
"scad": "\"C:\\Program Files\\openscad\\openscad.exe\""
Note: If you installed OpenSCAD to another location, use that instead.
- Add OpenSCAD logo for
.scad file extensions once that becomes a feature in VSCode. See Issue: 14662.
- Add to syntax highlighting
- Support for modifier characters (* ! # %)
- Parameters in functions should be highlighted in contents as well
- Add "Preview with OpenSCAD" button (Opens and previes the file in OpenSCAD)
- Add option for custom OpenSCAD installation director
- Contributes menu to preview any .scad file
- Extension auto-installs its own copy of OpenSCAD
- Add snippets for common things in the OpenSCAD cheat sheet
- Add peek/jump definition for symbols
- Have VSCode recognize function parameters in IntelliSense
- Block comment new lines keep '*' at the beginning of the line
- Create shortcut to open
.scad files with VSCode by default but has OpenSCAD icon
Note: Italicized items on the to-do list are more challenging and I do not know when (if ever) I will get to them.
See the changelog here.
I made this extension because I like OpenSCAD and there wasn't any language support in VS Code I liked. I will try and keep this extension up to date in the future, but I make no promises.
If you would like to contribute, here's what you can do:
- Fork the repository: https://github.com/Antyos/vscode-openscad.git
npm install to download node modules
- Make changes
- Submit a pull request!
Contributing to the Grammar
If you want to make changes to the grammar in the
.yaml-tmlanguage file, you will need to convert it to
.json before VSCode can use it.
npm install to download
js-yaml for the conversion process.
After that, you can run:
npx js-yaml syntaxes/scad.yaml-tmLanguage > syntaxes/scad.tmLanguage.json. Or, just run
makescad.bat to convert