Autocomplete+ - Service and Module Autocompletion

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.

  1. I’ll look into it and change it

  2. 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.

1 Like

Update: I changed the functionality, modules and services no longer appear first when you type in the colon key.

1 Like

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.

e.g.

after typing

--!strict

-- Services

-- Modules
:ServerScriptService

it will result in

--!strict

-- Services
local ServerScriptService = game:GetService("ServerScriptService")

-- Modules

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.

2 Likes

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.

1 Like

Sorry, I don’t think I’m fully understanding what you are suggesting. I also think you might’ve forgot to finish your sentence here:

I’m saying that it would be better if modules and services appeared first instead of not appearing first.

1 Like

That was the original functionality, what were you suggesting before then?

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.

1 Like

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.

1 Like

If a module being required is a descendant of the current script, can the require path start from the script?

e.g. instead of

local service = game:getservice("service")
local module = require(service.scriptname.folder.module)

it would be

local module = require(script.folder.module)
1 Like

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.

1 Like

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.

2 Likes

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

2 Likes

thank you for making a free version of sleitnick’s plugin :heart:

1 Like

No problem, I was creating it for my own use and I figured why not distribute it for free!

3 Likes

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.

Hope this helps!

1 Like

Where are these types of plugins when I’m looking for them… The example video alone shocked me, it had features I didn’t even expect it to have lol.

2 Likes

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.

2 Likes