Can you add the ability to change the preset? I noticed that it prompts me to use instance methods upon typing :.
Also, the ability to automatically place things in an order would be nice. For example, automatically placing services at the top of a script, or after a specific comment.
To my understanding something like this is not possible with Roblox’s ScriptEditorService and autocomplete callbacks. The way I work around this is requiring the services, then requiring the modules.
That’s not what I meant. I DON’T want services to appear when I type a colon with nothing before it.
: -- Modules and Services appear first
If something IS before it I want stuff to appear
Players: -- Autocompletes Methods
So it would be the complete opposite.
My other suggestion asked for a way to organize where the code for the autocomplete is placed, for example, if I have a comment named something specific (preferably set by the user, but I understand if you don’t want to have settings or anything), I can have the autocomplete place the code after that.
For your first feature idea, this is not something I will be implementing as I prefer, and I think many others also prefer the colon first syntax.
For your second feature idea, this goes back to my point of this not being achievable with Roblox’s built in autocomplete system, because you can only edit the line that the user is typing on, or lines below that.
I kinda feel like you missed what I meant. To put it short:
This should possibly be the complete opposite. If I type nothing before I type the colon, there are no methods I can use regardless, so the plugin’s autocomplete should be at the top.
The ability to customize the preset keybind, since : prompts you to use methods like :function. I didn’t know that you could change the order in which things got autocompleted.
Ah, I see. I don’t think I’ll be adding that feature as it overcomplicates a simple plugin. If you want you can download the plugin and edit the source to use a different key instead of the colon key. Just look at the moduleAutocompleteCallback and serviceAutocompleteCallback functions and edit the part where it checks for a colon with whatever key you want.
I’m not planning to add this feature, if you look at sleitnick’s module (require autocomplete) it has this feature, but it comes at a $5.00 pricepoint.
This is pretty cool, except it might be annoying to work with sometimes because it ignores the fact that users may have different conventions for naming variables - especially snake_case. In these cases, the plugin might keep adding services that have already been localised.
What I mean by this is that something like
local replicatedStorage = game:GetService("ReplicatedStorage");
wouldn’t be picked up by string.find, but you could fix this by looking for the string.lower version of both text and service.
However, something it completely ignores is something like:
local DATA_STORE_SERVICE = game:GetService("DataStoreService");
If you want to search more inclusively for localisations of services, you could try something like this:
local variableName = string.match(text, "local%s*([%w_]+)%s*=%s*game:GetService%([\"']"..service.."[\"']%)");
Such that something like
local service = "ReplicatedStorage";
local text = 'local replicated_storage = game:GetService("ReplicatedStorage")';
local variableName = string.match(text, "local%s*([%w_]+)%s*=%s*game:GetService%([\"']"..service.."[\"']%)");
print(variableName);
would yield replicated_storage.
Something to note is that local%s*([%w_]+) technically allows incorrect variable names, so if you wanted to be nit-picky, you might prefer local%s*([%a_][%w_]+) instead, insinuating that a letter %a, or _ _, must come first in variable names.
I’ve updated the plugin to support different variable naming conventions. If you already have a service required like: local replicated_storage = game:GetService("ReplicatedStorage") when requiring modules inside that script, it will be able to detect that the service is already there. This stands true for all variable naming conventions that I tested. But, if you require a module and the service is not already there it will default to PascalCase, which is the recommended naming convention for Roblox services
You may be interested in this plugin that I created a few months ago. It includes some features that aren’t in this plugin, such as placing services before modules, though it doesn’t work exactly like yours.
Since I am no longer updating it, you’re welcome to use its source to improve your plugin. If you do, credit would be appreciated.
Your plugin looks great, and I might check out the source for learning purposes, but I don’t think I’ll be updating this plugin anytime soon, unless I’m fixing bugs. Thanks for sharing this resource with us though.