LuaU autocompletion for custom modules has been completely broken for years

The autocompletion function has been broken for me for almost 3 years now. Currently its a huge pain working on large scripts without it.

System Information:
GPU: Nvidia GeForce RTX 4070 Super
CPU: AMD Ryzen 7 7700X
Ram: 64GB DDR5
OS: Windows 11

I have an “Engine” (master-library) module in all of my games that i often require to get different functions and services. But whenever i try to require it and get some of the services, autocompletion doesn’t work at all, even though it previews all the services that my functions returns.


As you can see on images above it previews my services, but doesn’t let me access them.
It’s not limited to Roblox services, but to ALL functions in ALL module scripts.


In large scripts, if basic autocompletion works it takes too long to active, ~5-10 seconds, basically becoming useless.
I believe autocompletion is really important for a lot of the developers on the platform, especially beginner developers and it not/barely working is awful and needs to be fixed ASAP. Ability to use another code-editor without workarounds like RoJo would be really appreciated.

A private message is associated with this bug report

1 Like

Hi @Itz_Thundi, sorry for the frustration. We recently released an update that should improve autocomplete performance, especially for large scripts. Is the issue still happening?

If possible, could you share the large script that reproduces the slowness so we can investigate further? Also, do you have any beta features enabled?

Hi there! I recorded the issue today, and i don’t remember the large script that had that problem since its been a really long time since this bug occurred.

Beta Features i have enabled:
Dragger QoL Improvements
Input Action System
New Studio Camera Controls
Improved LuaU type solver
Next Gen Studio Preview
Revamped Asset Manager
Script Sync
UI Styling
Unified Lighting

Update: I couldn’t replicate the autocompletion slowness issue in my new game even with large scripts (10k+ lines) it worked fine, so it’s not related to my main issue anymore.

1 Like

It looks like your type for Engine.Services is {[string]: Chat | HttpService | ...}, which represents a dictionary of strings mapped to a union of each service type.

This is not sufficient enough information for the type-solver to determine what actual string keys are in the table, nevertheless what they map to.

You would want to use a record table type for this instead, which should give you the autocomplete you expect.

type Services = {
	Chat: Chat,
	HttpService: HttpService,
	...
}

Hi there! It worked, but i don’t believe this is a proper fix to my problem since its just a workaround, not an actual fix to the problem. I believe most beginners don’t know about custom types in Luau and functions not previewing issue is still there.

Update on functions in modules not previewing: Changing the function name in the module allows you to preview it ONCE and then it never previews it again, which is a really strange behavior.

Update 2: This issue is ONLY present in Module Scripts, if i create a table with functions in Server/Local script, it works perfectly.

Update 3:

I have New LuaU type solver disabled. Enabling/Disabling doesn’t fix the problem.

1 Like

You’re populating the table at runtime. The type checker isn’t smart enough to actually “run” the for-loop and figure out what’s going to end up in FinalTable. It especially cannot read .Name, which is just a generic string (inherited from Instance).

It’s not a bug. You could request that they add this feature, but it’s likely far too complex.

Side note: how much time do you really save by typing Engine.RunService instead of game:GetService("RunService")? Personally I’d just remove this feature altogether.

1 Like

Hi there! I don’t really save much time by doing that, but it looks cleaner since i don’t have a bunch of services in all of my scripts, only 1 clean module instead. I remember type checker working properly with my Engine module for some time before, i could use autocompletion to access services and everything worked correctly. ~2 weeks ago it broke completely, but this time i can’t even access functions in module scripts which i believe, is way more important than my services issue. Thank you for your help!

Hello! Thanks for the report!

We do the best we can, but there are always going to be limits to what type inference is able to understand. It’s just not possible for us to infer this sort of dynamic table initialization.

Your best bet is to write the code in a way that Luau has an easier time following, or to write an explicit type annotation.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.