Snips - Save time while programming by using snippets

Note

Because this plugin uses the new Script Editor API beta feature, it will not work if you don’t have said feature enabled. Since it’s in beta, this also means that Roblox may make code-breaking changes but I’m hoping that that’s not happening anytime soon. (lol)

To enable it, go to:
File > Beta Features > Enable Script Editor API
Restart studio for changes to take effect.


Snips

image

Programming in Studio can often be quite slow and repetitive, especially since you are frequently reusing similar lines of code over and over.

Other snippet plugins have been made in the past, but since the Script Editor API wasn’t available, they all reset the cursor position back to the start. This plugin lets you continue coding without having to go back to where you were every time.

This is why Snips was created: it’s a simple tool that lets you use code snippets with ease, but it also has lots of customisation to offer.


How do I use it?

Click here, and press install. The plugin is now yours!
It comes with a few snippets by default, such as:

!gs(x) ==> local x = game:GetService(x)
!hdr() -- creates header comment, too long to show here 
!class(class_name) -- adds class boilerplate, too long to show here

The snippet syntax works similarly to normal functions: you have the function name, parentheses, as well as arguments inside those parentheses.
Let’s test it out by opening a Script:


note: Press spacebar after entering the snippet for it to be replaced.

How do I add my own snippets?

Click on Edit Snips in the plugin toolbar.
Screenshot 2022-07-30 at 19.57.55

The Snips Editor should now be open. At the top, you’ll see a list of instructions explaining how to make your own snippets. Follow these instructions and you’ll be set!
If the instructions are a bit confusing(I’m not the best when it comes to explaining things), you can take a look at the built-in snippets and you should have a good idea of how they’re done.


Feel free to send any of your own snippets down here, if you believe they may be useful to anyone else.

Since this plugin is fairly new, it may contain lots of bugs. Feel free to send feedback by either sending me a DM or submitting a reply to this topic.

Thanks for reading! :slightly_smiling_face:

26 Likes

I like how it works. I’m sure this will save me a lot of time, thank you!

3 Likes

I think a public snippet library would be pretty cool, obviously you would have to approve them but you could use HTTPService and host some web service or something with all the snippets in it

3 Likes

If you’re wondering why this plugin isn’t working, copy the plugin and open the MainScript that is named “Snips” and then change lines 112-116 to

ScriptEditorService.TextDocumentDidClose:Connect(function(closedDocument)
	if closedDocument.Name == snippetEditor.Name then
		ReloadSnips(false, true);
	end
end)
1 Like