Studio › Manual › Code and objects

Snippets

Snippets are ready-made code with fields to fill in: for, forr (backwards), while, do, repeat, if, ife, with, switch, case, function, method, constructor, struct, enum, try, region, macro, and event templates (create, step, draw, drawgui, collision, alarm, destroy).

  • Insert: type a snippet's name and pick it from the completion list (its icon is the snippet badge), or choose Code > Insert Snippet… (⌃⌥Space) and type to find one; Return inserts.
  • Fields: the first is selected; type over it. Tab goes to the next field, ⇧Tab back. A field used twice (the i of a for loop) changes in both places as you type. After the last field the caret goes where the snippet ends. Esc stops.
  • The snippet is indented like the line it's on, with the file's tabs or spaces.
  • Your own snippets: Code > Editor Settings… > Snippets: New Snippet…, or Copy a built-in one to change it (yours is used for that name). In the code, ${1:name} is a field with its text, $1 repeats it, $0 is where the caret ends.

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.