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.

3 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