Loading

OpenScad NotePad++ AutoComplete with CallTips

by garyacrowellsr, published

OpenScad NotePad++ AutoComplete with CallTips by garyacrowellsr Oct 18, 2013

Contents

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

7485Views 2541Downloads

Summary

NotePad++ is a free programmer's editor that works wonderfully in place of the OpenSCAD internal editor. If you aren't already using NotePad (or some similar external editor), you're definitely limiting your OpenSCAD productivity.

There have been a couple of NotePad++ AutoComplete files posted on Thingiverse for OpenScad (including one of mine), but none have implemented the CallTip feature of NotePad. You're familiar with autocomplete - it's the sometimes annoying feature (that you sometimes turn off) that completes a word after the first few letters are typed. The CallTip feature (aka ToolTips) pops up a box detailing the command syntax of the item being entered.

In the implementation here, I've configured the Autocomplete to be active for nearly all OpenSCAD commands and terms, and, I've extended that somewhat to include combinations of commands that I find I use often. For example, just typing "tra" plus a couple of down arrows and enter, will enter:

translate ([0, 0, 0]) rotate (a = [0, 0, 0]) cube (size = [1, 1, 1]);

CallTips in NotePad++ are intended to assist with function-type commands only, but I have implemented it to include many non-function type statements. Nearly all OpenScad keywords have a CallTip, which is brought up by typing an opening parenthesis "(" at the end of the word. In some cases ("if", "polyhedron"), these CallTips can be quite extensive, including examples of use. I intend to expand this further, as this is definitely a work-in-progress.

The language file was originated by Justblair, Thing:15363, and lately I have made some updates to it.

Updated 10/23/13: Added some closing parens and semicolons where it seemed appropriate and made spaces more consistent.

Updated 05/15/14. Fixed a few typos, added a few more keywords and calltips; updated the language file. Improved the install instructions a little bit, but yeah, I get confused too.

Instructions

Installing the programs:

If you haven't already, install OpenScad from
http://www.openscad.org/

If you haven't already, install NotePad++ from
http://notepad-plus-plus.org/

Note The most recent versions of NotePad++ seem to have broken the autocomplete and calltips file. The NotePad++ site contains all older versions, so I would recommend using v6.5.3 This seems to be the latest one that works for this..

Installing the files
Download the two files included here, OpenSCAD_API.xml and OpenSCAD_language.xml

Copy the file OpenSCAD_language.xml to the directory C:\ProgramFiles(x86)/Notepad++ and change the filename to OpenSCAD.xml

Copy the file OpenSCAD_API.xml to the directory C:\ProgramFiles(x86)/Notepad++/plugins/APIs and change the filename to OpenSCAD.xml (yes, the same filename as the other one, so don't get them mixed up!)
.
Configuring the software

In OpenSCAD, click the Design menu item, and under it, check the Automatic Reload and Compile item.

In NotePad++ click the Language menu and select the Define your language... item. In the open dialog, click the Import.. button. An Open File dialog will open; navigate to the language OpenSCAD.xml file and open it. If you now look under the Language menu item, OpenSCAD should appear at the bottom.

Under Settings/Preferences, Auto-Completion tab, enable auto-completion, Function and word completion, Function parameters hint, and the number of characters (2 or 3).

Under Settings/Style Configurator.. select a Style theme with a darker background color (that works with the OpenSCAD keyword highlighting) and check Enable global background color.
.

Using OpenSCAD with NotePad++ AutoComplete and CallTips

Open the same .scad file in OpenSCAD and NotePad++. The NotePad window should be displaying the file with proper syntax highlighting. After editing a file in NotePad, entering Ctl-s will cause the file to be reloaded and recompiled by OpenSCAD. You can minimize or hide the OpenSCAD editor window - you won't want to use it much anymore.

AutoComplete: Typing the first two or three letters of an OpenSCAD keyword, will open the AutoComplete box and you can arrow up/down in this box to select the word to complete, and enter will enter the word.

CallTips: The CallTip feature in NotePad is intended for use with program functions, so the character set to open a CallTip is the open parenthesis "(". In the AutoComplete box, most keywords are shown with and without a "(". If you select one with a "(", backspace over it, type a "(" and the CallTip will appear. If you select one without a "(", just type the "(" (even if that keyword doesn't normally have an opening paren), and the CallTip will appear (if one is associated - most do, a few don't, yet).

All Apps

Upgrade this Thing with Thingiverse Apps


No results.

works great in openSCAD 2015.03-1 and Notepad++ 6.7.9.2
I just followed the install instructions. had to choose Twilight theme.
I should make a light theme version I suppose.
Thanks heaps.

Much better! I was just begrudging the poor UI of OpenSCAD. Thanks for the write-up and library, this will be my new go-to for OpenSCAD!

should update the instructions to change the "current line background" and "selected text color" to something non-white, non-light. i chose dark purple and dark grey respectively

Updated 10/23/13: Added some closing parens and semicolons where it seemed appropriate. Added some spaces to make things more consistent. Remember, if you don't like my style or want to add something that you use often, you can edit the openscad.xml file yourself - just open it in Notepad (after saving you'll need to exit notepad and restart it). Just remember, one formatting error and you've 'broken' the file - no hints about where/what is wrong, so I suggest you make changes in small increments and test frequently.

In your instructions you have:"In NotePad++ click the View menu and select the User-Defined Dialog.."

I've installed Notepad++ v6.5 and there is no User-Defined Dialog.. under the View menu or any of the other main menu items.

Any suggestions?

Nope, you weren't confused, I was. I've edited the thing to fix the instructions. Thanks for the Beta test.

Top