Why I made this plugin
I recently came across a plugin created by sleitnick that adds autocomplete suggestions for requiring modules when typing :modulename, and this plugin seemed like something I would find useful - until I realised it was available for $6.99.
This price seemed crazy to me, given how easy a plugin like this would be to create, so I have decided to create and upload, for free, an alternative for this plugin that has pretty much the same use case as sleitnick’s.
Credit
rinqed, scripted this plugin
aidan9382, provided the regex needed
sleitnick, inspiration to create this plugin
The plugin
The plugin is available from the following link:
How to use
To use this plugin, begin by typing : followed by one of your ModuleScript’s names. It will ignore your : if it is immediately preceeded by a non-whitespace character, so that if you had a service named GetService for example, game:GetService would not try to autocomplete it as a module requirement function. For example if I had a ModuleScript named PlayerController, I would type the following code:
:playercontroller
The plugin will begin giving you autocomplete suggestions from the moment you type :p, and will filter down the more that you type. You are also able to type something like :controller to return all modules that contain Controller, for example if I had a plugin named PlayerController and a plugin named PetsController, I would be able to type this:
:controller
And these plugins would also pop up.
Extra information
This plugin runs in the background. There is no icon in the plugins tab, to remove if just manage plugins and find remove there. You can also view the code by checking your locally installed plugins, or by inserting it using InsertService:LoadAsset if you are sceptical about the code behind it.
It also supports multiple different ways that people may localize their service variables, works for any Service that the module may be under, and will search for already localized services before inserting them itself. For example the following ways of creating a service would be detected (with any variable names, and either " or ’ for the string)
local rs = game:GetService("ReplicatedStorage")
local rs=game:getService'ReplicatedStorage'
If the service does not already exist or was not detected as a localized variable, it would autofill, so selecting the autocompletion for :playercontroller would result in this:
local ServiceName = game:GetService("ServiceName")
local PlayerController = require(ServiceName.Path.To.PlayerController)
If the service already exists as a localized variable (and has been detected), then the following code will be inserted when you select the autocompletion.
local PlayerController = require(ServiceLocalVariable.Path.To.PlayerController)
If you have any feedback on this, it is very much appreciated and I will update this plugin given any issues are found.
Inspiration
sleitnick’s plugin (the original inspiration) can be found below.