Autocomplete does not recommend anything after writing 'function'

Description

When declaring a function for a table, autocomplete does not offer any recommendations after writing function.

Repro

In the script editor, type in the following:

local Module = {}

Module.Value = 1

function Module:Foo()
	
end

Notice how when delcaring Module.Value, “Module” is recommended, but when declaring function Module:Foo it is not.

Expected Behavior

I expect Autocomplete to give me recommendations after writing function.

5 Likes

We’ve filled a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for the report!

2 Likes

We moved this thread to #feature-requests:studio-features as an engineer confirmed this is not a bug!

1 Like

It would be great to have the engineers directly responding to these threads explaining exactly why things are not a bug when they are not.

2 Likes

Hello.

Because defining a global function or a local variable usually involves introduction of a new name we didn’t intend to provide autocomplete suggestions in these cases.
While it’s true that it might be a method definition on a table in the scope, we don’t know that until we get to ‘.’ or ‘:’.

In essence, we don’t have a code with a bug for this situation, we don’t have any code at all.

Having said that, for Luau we try to discourage definitions of global functions, so we do have an opportunity to treat ‘function ___’ as a beginning of a method and suggest tables available in scope.

1 Like

Would be great to have this feature

For anyone who stumbles onto this thread that shares the same sentiment, I’ve actually made a plugin that adds this exact functionality to the roblox intellisense inspired by @sleitnick’s Require Autocomplete plugin.

Table Function Autocomplete

This should significantly improve the module workflow as manually referencing the table name when making functions has always been a pain point.

Furthermore, the plugin automatically accounts for any amount of preceding or trailing whitespace allowing it to work in any scope.

1 Like

Love it. I think I might try to add something like that to the plugin

4 Likes