This feature just kind of fell into my lap. I was looking at the CodeMirror API and realized that the
replaceSelection function could be used to programatically insert code into the editor. I’d been using Phrase Express (a text expander type program) on Windows to automate my own snippets, but saw how easily this could be built in to the program. So now there are snippets.
On the far right you’ll see two dropdowns and buttons. The first has every possible object you can create in GLC. The second has a few useful snippets I’ve come up with.
Move your cursor to somewhere in the code, select a snippet, click the appropriate insert button, and there you go.
For the object snippets, I didn’t include every possible property, but tried to include the ones I thought would be most needed, with some obvious values. Let me know if there’s anything you think should be changed there.
For the other snippets, I included a few that I’ve found useful myself. I’d like to add to this list. Feel free to send me any you think would be useful. Eventually, I’d like to get to the point where you can define your own snippets, at least in some kind of external file.