Snippets | Quick, Powerful and Customizable Code Templates


Customizable shortcuts inspired by VS Code Snippets for Roblox Studio

Plugin | Demo | User Guide (soon)

(Plugin contains some documentation out of the box.)


  • Easy to use snippet editor
  • Built-in example templates with instructions
  • DockWidget UI
  • Simplistic user interface
  • Lookbehinds/Lookaheads for arguments passed to the snippet
  • Whitespace preservation for snippets in the middle of code blocks


Click to view FAQ

Can I make arguments to snippets optional?

Unfortunately, it is currently not possible to make optional arguments with user defined snippets. It is possible to do internally, but unless you know what you are doing I do not recommend trying to implement it yourself. The internals do not have as much documentation.

Why does my cursor position get reset when I input a snippet?

Due to the limitations of Roblox Studio, there is no way for a plugin to set the position of the cursor in the script editor. We would love to make the cursor position properly but it is not possible at the moment.

Can I edit the default snippets?

For the most part, yes! The only exception to this rule is you cannot edit special snippets like eval or go because they are implemented differently internally.

Can I disable the use of snippets in my script?

Indeed you can. If you wish to disable all snippets for any specific script, just add an attribute named "snippetLocked" to the script and set the value to anything that isnt falsey.

Why Snippets?

While I was researching other implementations of similar modules, I came across this plugin by A1rfoil. To be clear, I think the plugin is good but it has some pretty obvious issues which are solved by Snippets.

The worst issue with that plugin in my opinion is the lack of arguments to the snippet code. It supports basic syntax for things like the time but its not flexible enough to be very useful and as far as I’m aware there is no way to define your own replacements.

Snippets completely solves this issue with the use of Lookaheads and Lookbehinds. Your snippet can take any number of arguments and you can use them anywhere in the snippet via $kn where n is the index of the argument. This allows for some pretty interesting templates like the included class template. The only limitation is that you cannot make optional arguments.

Snippets also implements some non standard snippets that don’t follow the simplistic find → replace idea behind the rest. They have much more utility. They aren’t user creatable (mainly because it would be a pain to serialize user functions + limitations with upvalues) but as a result, they are much higher level. As an example, if I use the snippet:

--(this just uses loadstring internally so you can put any valid lua code here)
--@eval {2 + 2}

It would actually output 4 to the console.

While the utility snippets aren’t exactly the most useful things all the time I think they are pretty fun and can speed up how fast you navigate Studio.


  • Honorable Mentions

This reminds me of UserSnippits in VSCode. Looks very useful; thank you for the plugin!


There’s also Code Templates which seems to do a similar job.


Ooh, thanks for bringing this to my attention. After doing some surface research into the plugin it seems to have the same shortcomings as the one I linked before. It has some amount of variables using $VARNAME$ syntax but is too rigid to be useful for snippets. It mostly seems useful for watermarking scripts and basic find and replace stuff.

1 Like

Really excited about this! Snippets was the biggest thing I wanted from vs code so psyched to see this plugin. Thanks so much for making!

I’ve made some notes from initial use for feedback. I only ran into two major issues:
– Snippets don’t save once a place is closed.
– Snippets broke when I opened a new place with a current place/snippets already open.
– Edit: I added several of my own snippets directly into the json file to get them to save. The plugin loads them into the gui correctly but has otherwise stopped working entirely.

Some other notes from initial use:

  • Snippets don’t replicate across places.
  • Using the plugin generates a ton of discarded scripts in Drafts when Team Create is enabled. (Not a huge deal just noting it)
  • Snippets don’t work unless the plugin is actively toggled on
  • The plugin automatically closes when you edit a snippet, which then disables snippet functionality. Spent quite a while confused on this :smiley:

Feature Suggestion: Ability to edit snippet trigger (–@)


The fact that user created snippets aren’t saving for you is incredibly weird. I’ve never run into this issue which makes me think that its an issue with team create? The plugin also works for me when not actively selected. I’ll look into fixing compatibility issues in v1.2. In the meantime, can you provide any error information if possible? You might be able to try deleting settings.json entirely and relaunching the plugin.

As for the suggestion, I already have this on the roadmap. Hopefully this should be implemented by the next update but I mainly want to focus on fixing preexisting issues before adding new features.

Also, if you encounter issues where snippets seem to be replacing slowly just know this isn’t something I can remedy. Roblox released a major update to the editor 24 hours before I intended to release the plugin and I have been scrambling to fix things as I discover them. They specifically made it so script.Source only updates after you stop typing as opposed to after every keystroke.

Oh wow that’s a huge bummer on the release timing :(.
I’m a bit slammed right now but I’ll mess with it again when I get the chance and let you know what I find. I had updated the trigger in the module manually but that worked until I tried adding my own snippets to the json. I’ll try to delete the json and see if it fixes.

Hi Art - I tried reinstalling and still no saving. Perhaps I’m doing it wrong?

Feel free to reach out on Discord @TheAlchemist#2121 - interested in keeping this rolling