Quicks - A Smart Snippet Coding Tool

Quicks

Note: If you want something simple this can be super simple, but all the docs below are also for advanced users

What is it?

Quicks is a plugin that lets you type short “commands”, and it will generate the full code.

Quicks Demo

How does this differ from other snippet tools?

This one is different because it’s more than just simple snippets. This one has many other features like importing module scripts by name(it will find the one you want and import it), generating arrays of any size auto-filled with anything, as well as auto importing services when they are not imported, and smartly using already imported services to get module scripts instead of making its own. On top of that, it supports you to make your own snippets that range from just simply replacing text to analyzing the rest of the document and making smart decisions. Making your own “commands” is simple, and contains a built-in API for doing more advanced things that you might not want to code yourself. In short, it’s smarter and super easy to extend.

I still do recommend taking a look at other tools, because they have their own advantages like a nice UI that might be a little more beginner-friendly when adding your own commands, but this does limit them to very basic functionality(almost like a copy and paste).

How do I use it?

Note: To use this you need to enable the script editor API under beta features, and also when installing the plugin allow the permissions it needs like “Script Injection”.

Basic Use:

To use it just install the plugin, and then if all settings are on default settings then you can start by typing “>”, this is the default opening character for all commands. Then just type a command after that. Eg. “>GS(Players)”, will get the player service after hitting tab after the last character on that line. It should look like this: local Players = game:GetService("Players")

Note: commands are case sensitive unless you edit that in “Quicks Config”

Built in commands

  • GS(ServiceNames) - This gets the service input. If you need multiple services you could do >GS(Players, Lighting, ReplicatedFirst)
  • MS(Module Script Name) - This will search through the whole project and find a module script with that name. Again this can be used with multiple scripts, and these will all be imported on separate lines. >MS(PlayerLogic, InventoryManager)
  • ARR(length of array, default value of all indexes, ?array name) - This generates an array. The array’s name is not needed. >ARR(10, 1) will create local array = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, >ARR(5,2,Number2) will create local Number2 = { 2, 2, 2, 2, 2 }. Also, Note that the character ~ will get the current index of the array, this can be multiplied or have any basic math applied to it. Here is an example: >ARR(5,~ * 2,MultiplesOf2) will create local MultiplesOf2 = { 2, 4, 6, 8, 10 }
  • CLASS(Class Name) - This will generate a basic class template. To generate a class with the name Tree we can write >CLASS(Tree)

That is all for now. If you have any suggestions for commands or improvements feel free to tell me.

How do I add my own commands?

You can add your own commands by finding the module script named “Custom Quicks” if it’s hidden try typing >show in the terminal (You can also use >hide in the terminal to hide both of the plugin config files). Once you locate this file and open it you will see this:

-- doc is the whole document of the modified script

-- arguments is an array of items within (), and split by commas (assuming the ARGUMENT_SPLITTER is a comma)

-- EG. >TEST(hello, world) makes arguments equal to {"hello", "world"} (All passed-in values are always strings)

-- Also note that if you make a command that has the same "command" as a built-in command it will overwrite it

return {

	["TEST"] = {
	
		func = function (doc, arguments, Utils, Settings, Defaults)
		
			return "This replaces the command"
		
		end,
	
	},

}

Note: Naming your command the same name as a default command will overwrite it

This already has a custom command in it called TEST. To try it out you can do >TEST() or >TEST in another file, and it should replace with what’s in that return statement. To change the name just change where it says [“TEST”] to whatever you want your commands name to be. Then inside func, you can code whatever you want it to be replaced with, not limited to plain strings. If you want to make more than one custom command you can copy this:

	["ANOTHER_COMMAND"] = {
	
		func = function (doc, arguments, Utils, Settings, Defaults)
		
			return "This replaces the command"
		
		end,
	
	},

Then add that below where the test command ends.

So what are all these parameters in the function?

  • doc is just a ScriptDocument (there is no proper documentation for this out yet unfortunately)
  • arguments is an array of all the things passed into the command, its a good idea to always check and make sure that the correct amount of arguments are passed in
  • Utils contain a lot of utility functions to help with stuff you might not want to code yourself, more on this later
  • Settings is a table of all the user’s settings in “Quicks Config”. It even supports custom settings if you add it to the config file! Eg Settings.PREFIX will get the current command prefix, probably > if you have not edited the config
  • Defaults return the default functions for all the built-in commands, this can be used to rename a default command or to extend its behavior. More on renaming commands later.

Utils (For making your own commands easier and faster)

There are many helpful things under the Utils perimeter when making a custom command.

  • PLUGIN_NAME - Yea this gets the plugins name
  • Version - If you ever wanted to check the version, here you go
  • CheckPeramCount(requiredPeramCount, params) - returns true if there are at least x amount of params required when the command was ran
  • Warn(Warning Message) - Let’s you put a warning in the console. Good for letting them know they passed too few arguments in or something
  • Trim(str) - Trims whitespace at the start and end of any passed-in string
  • SplitBy(str, splitArr) - returns an array split by multiple different characters instead of just 1. Use like Utils.SplitBy("Another-Hello.World", {"-","."}) This would return {"Another", "Hello", "World"}
  • IsValidServiceName(serviceName) - returns true if its a valid service name
  • GetServicesString(serviceList) - returns a string that contains all the code needed to import all the services. Basically, this is what >GS(services) does and uses
  • FindObj(loc, objType, name, whitelistedCategories) - this returns the found object. loc is the root location you want it to search(will only search under the whitelistedCategories param), objType is a string of the object type you want, for example "ModuleScript", or "Part", can be nil. name is the name of the object you want to find. whitelistedCategories is an array of areas it can search. Its recommended to pass in the settings SEARCH_LOCATIONS, but if you want to confine the search even more you can here.
  • GetVarName(lineString) - gets the name of a variable on any given line. Pass in the line as a string
  • IsGetServiceLine(lineString, service) - This makes sure that there is a variable that holds a service on that line. Returns a boolean. lineString is the string of the line you want to check. service is the service we want to check for.

Renaming commands

Renaming commands is simple. Let’s say you want to rename the GS command to GetService. To do this you would do the following:

return {
	["GS"] = {
		func = function (doc, arguments, Utils, Settings, Defaults)
			--Make the default one do nothing
			return nil
		end,
	},
	
	["GetService"] = {
		func = function (doc, arguments, Utils, Settings, Defaults)
			return Defaults["GS"].func(doc, arguments, Utils, Settings, Defaults)
		end,
	},
}

First, we are overwriting the default GS command so that it does nothing. Then we are making our own GetService command and just telling it to use the default GS function.

Some Extra Stuff

  • Commands that don’t need any perimeters can just be run without even requiring parenthesis. Right now no built-in commands can be run without any arguments so it only applies to custom commands

  • When this plugin updates and has some extra settings added, it will automatically open the settings file and add all the missing settings. It won’t change any already set settings

  • I want to sometime make an actual website with all the documentation split up better, but for now, this is all there is.

  • If updates are slow it’s because I’m working on my own games, and other things. Thanks for understanding :slight_smile:

  • If you create a really useful command feel free to post the source code and what it does, and if it’s okay with you ill try to implement it into the core plugin.

  • Want anything else in this plugin? feel free to ask :slight_smile:

  • Feel free to report any bugs down below, ill get to them when I can.

Get The Plugin Here

38 Likes

Update: major bug fix.
This bug seemingly got pushed to a later patch update. This made it so the plugin couldn’t init properly, and that made the plugin not work at all. This should be fixed now, tell me if you find anything else.

This plugin is very useful, maybe add some more defaults.

When using spaces in names of instances it will try to make a variable with spaces when using >MS() I know using spaces isn’t smart for instances but maybe a thing you should fix.
Off topic: I don’t use spaces, was just for testing purposes.

Also when using >show maybe print something to say it was success, some people don’t have an organised game and spam it because they don’t see it.

I would recommend using this to save custom quicks and the config:
Plugin:SetSetting()
Plugin:GetSetting()

1 Like

I made a custom quick that makes a killpart.
How to use
1: Run >show in the terminal if you haven’t done this yet.
2: Paste the code (seen below) into the Custom Quicks module script. Place it above the last comma(highlighted in the screenshot)
image
3: Use it like any other quick. (>KILLPART(Part))
Notes
-You can also use multiple instances but I don’t recommend it. (Use CollectionService instead it is a lot less messy with 2+ parts)

-This is just something quick to learn the api.
Code

		func = function (doc, arguments, Utils, Settings, Defaults)
			if arguments[1] == "" then
				Utils.Warn("Please provide a part.")
				return
			end
			
			if arguments[2] then
				Utils.Warn("Consider using CollectionService(https://create.roblox.com/docs/reference/engine/classes/CollectionService) for multiple kill parts. (This quick will still run)")
			end
			
			local result = ""
			
			for _, argument in arguments do
				if result then
					result = result.."\n"..argument..[[.Touched:Connect(function(hit)
	local Humanoid = hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid", true)
	if not Humanoid then
		return
	end
	Humanoid.Health = 0
end)]]
				else
					-- Removes new line from first part.
					result = result..argument..[[.Touched:Connect(function(hit)
	local Humanoid = hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid", true)
	if not Humanoid then
		return
	end
	Humanoid.Health = 0
end)]]
				end
			end
			
			return result
		end,```
1 Like

Hello. I am planning to add more. Also ill have to investigate the space bug.
What was the exact “command”/quicks that you ran?
Was it >MS(Module Script)?
After some testing its probably that, I will add this to my list of bugs to fix.

Also it does use
Plugin:SetSetting()
Plugin:GetSetting()
They save when they are modified.

Yes, it was exactly that.

Oh, I didn’t know that.

1 Like

Alright well that should be fixed now!
>MS(Module Script) now gives you
local Module_Script = require(StarterPlayer["Module Script"])

Thanks for the report!

1 Like

Update 0.1.1

Fixed bug where spamming >show would create multiple of the same config file. This would confuse the plugin.

New Beta Feature:

Ability to install plugins other people have made just from a command line command

How do I install modules through it?

In the command line you can type >install (module name)
To execute it add a space to the end of the command(this is a limitation of custom terminal commands, ill probably be moving most commands to UI soon.)
image
If this is your first time installing you will see something like this
image
Allow it so it can download the module

What are modules?

Modules are things you can install to gain a bunch of new quicks. A module can contain 1 or more quick.

Warnings on this feature

No there shouldn’t be any viruses since when commits are made to the repo it will go though a verification process. The issue is if there is already a quick with the same name it may conflict. In the future I want to make it check for this, but for now open the file and make sure there are no issues. Rename any commands that are conflicting.
Another issue is that if your last curly brace in the return doesn’t end in a comma it will just append the module without adding one. You will need to add one manually.

How can I make a module that can just be installed?

  1. Go here to the github repo
  2. read the README on how to format the file.
  3. Add your stuff and make a pull request. You need to wait till it gets past this verification step till it gets put in the main repo.
  4. If all goes well you should be able to type >install (module name)

So whats my module name?
Your module name is whatever you named your folder. (It cant be named the same thing as another folder, all module names have to be unique)

If you cant figure this out, or don’t have a GitHub account feel free to reply to this or contact me, ill put it up for you if you send the code. :slight_smile:

Thanks for reading!

Is the module broken? I’ve enabled beta, enabled the script editing beta feature and installed + restarted studio.The plugin is there, but it doesn’t work and prints these errors to the console:


  19:25:47.763  DataModel Loading https://assetdelivery.roblox.com/v1/asset/?id=11082814635  -  Studio
  19:25:50.421  [Quicks] Error Saving  -  Edit
  19:25:50.421  [Quicks] A config saving error occured. File not hidden  -  Edit

Any idea what’s going on?

Hello, this sometimes is a false error message, try to see if it all works fine. If its not working then feel free to reply again. I will look into the false errors though.

Update 0.2.1

This update 1 major thing has changed, custom Quicks can now declare configs.
image
These configs can be edited in the Custom Quicks file.
You can then use them in your code like this
image

Note:

  • If you name your setting the same thing as a built in setting it will be overwritten. To make sure that this wont happen ever you can use lowercase since all official names will be all caps.
  • It has been implemented in a way so that other quicks cannot access the same settings. Right now this is both good and bad. Its good because for security reasons no quicks can access eachothers settings. Its bad because if a quicks pack has many commands they cannot access their commands. For now this is going to stay that way.

Minor changes:
Since on install there is an error due to a missing config file(since it has not been made yet) I added a disclaimer saying it may not actually be an issue. This is probably a temporary fix.

New command

>TSPAWN - No arguments, and expands to task.spawn

Special Mentions

3 Modules were made since the last update

ezprint - To install type >install ezprint (remember the space at the end) This one lets you type >P(Put whatever here), this expands to a regular print statement (By KevinWho)

lorum - To install type >install lorum This is not only a demo for the new settings, but also lets you generate placeholder text as a string (By KevinWho)

killbrick - To install type >install killbrick This lets you pass in a part(or many) and turn them all into kill bricks! (By Maxi130TV)

(Ill add anyone else that makes a module here)
or if you cant post it there just feel free to share the code and ask me to do it along with the name of the module

Do custom quicks save between games?

1 Like

i found a bug where it removes the close parenthesis for some reason

["Var"] = {
	func = function(from, arguments) -- arguments: variableName, value
		local function lowerCaseFirstText(String)
			local newString = String

			if #String == 1 then
				newString = string.lower(String)
			else
				for index=1, #String do
					local letter = string.sub(String, index, index)

					if String ~= " " and string.match(letter, "%w+") == letter and not tonumber(letter) then
						if index == 1 then
							newString = string.lower(letter) .. string.sub(String, index + 1, -1)
						else
							newString = string.sub(String, 1, index - 1) .. string.lower(letter) .. string.sub(String, index + 1, -1)
						end

						break
					end
				end
			end

			return newString
		end

		print(arguments[2])
		return "local " ..  lowerCaseFirstText(string.gsub(arguments[1], "\"", "")) .. " =" .. arguments[2]
	end,
},
>Var(ReplicatedStorage, game:GetService("ReplicatedStorage"))
-> local replicatedStorage = game:GetService("ReplicatedStorage"

overall 10/10 I love the plugin

1 Like

Really good idea, but the lack of autocomplete make plugin almost useless in the sense of time saving

1 Like

Interesting, ill have to take a look at that. Its probably searching for the first closing parenthesis, gotta change it to the last closing parenthesis. It may be a while until I can fix this though, but ill reply to this when I do! Also thanks for the rating :slight_smile:

I would love to add autocomplete to my plugin however I dont think the Roblox API supports this. If im wrong send me the link to the API and ill add it ASAP! Also I do think it still saves time as >GS(Players) is quicker than local players = game:GetService("Players")

Thanks for your feedback!

Edit: I think I may have found the API: ScriptEditorService | Roblox Creator Documentation

1 Like

I think they should, but I have not tested it, and its been a while since I checked that bit of the code. It may get a little weird with Teams though since if anyone edits the config file it may or may not sync. Otherwise it should all work.

Update 0.3.2

Autocomplete

This has recently been suggested, and I thought it was a good idea. Not only do the built in Quicks have autocomplete, but also any Quicks you make can too!



To add this feature to your own Quicks you must add docs, and if you have any code/examples you must add example.
Here is how its done in the default built in example quick:

Oh and your custom Quicks also have live updating autocomplete!
Next up is:

Undo states

Made a mistake? cntrl + Z will now work to undo a Quick or a Quick autocomplete.

Bug Fix

(Apologies for light theme, I had to update this plugin away from home and forgot to set my theme lol)

2 Likes

Alright autocomplete has been added.

2 Likes