Auto Complete for Module Functions

Basically, what I mean by auto complete is that when you do game:GetService(), it shows a list of services (strings), is it possible to do this for functions in modules?

i wish they can add this. This will make developing modules much easier

Im guessing that they don’t have this feature, but yes I agree it would definitely make modules easier.
Edit : By easier, I mean like if you make a typo when typing a string, it might be a bit hard to find out why it didn’t work

This would make module scripts WAY better, as making module scripts is hard for me (and maybe also for orthers)

I’d recommend moving this post to #feature-requests.

1 Like

For some reason, I can’t find the category feature-requests
Edit : I guess I can tag it though.

You can indeed do this:

type Services = "MyService" | "AnotherService" | "Service3"

local function GetService(service: Services)
  --...
end
4 Likes

wait u can do this. did not know that

Wow, I did not know that, thanks!

yh while this works, it does not do any thing than show auto complete dropdown

local module = {}
module.Hello = function()
    print("hello")
end

export type Service = "Hello"

function module:GetService(Service: Service)
    return module[Service] -- it does not have other auto complete features for it
end

return module

This is due to how the Luau Type Checker current utilizes strings. It doesn’t evaluate strings as literals yet, so everything you pass through is simply seen as string.

There is a request for literal interpretation to be added to the engine:


So yea, for now, unfortunately it’s only good for autocomplete.