How to solve this "auto complete/suggestion" issue, or are there any other tools with an improved "auto complete"?

With the Auto Complete/Suggestion I mean this system here:

See how it beautifully gives me all the members of that Module Object.

local TestModule = {}

function TestModule.example(arg1, arg2)
	return {arg1, arg2}
end

return TestModule

However, this is basic and Roblox is simply able to understand it.


But things get more inaccurate, when you change things.

Here, I override the function called “overridable”, but it still suggests me the wrong auto suggestion.

Example2 ModuleScript
return function(vargs)
	-- Maybe some initialization stuff with "vargs"
	
	local innerModule = {
		example = function(arg1, arg2)
			return {arg1, arg2}
		end;
		
		overridable = function(arg1)
			return true
		end;
	}
	
	if (typeof(vargs) == "table") then
		if (typeof(vargs.overridable) == "function") then
			innerModule.overridable = vargs.overridable
		end
	end
	
	return innerModule
end

Or at this point it doesn’t show it anymore at all.

Example3 ModuleScript
local TestModule = {}

function TestModule:Init(vargs)
	local funcs = {
		example = function()
			return "example"
		end,
	}
	
	for k,v in pairs(funcs) do
		self[k] = v
	end
end

return TestModule

Example4 ModuleScript
local TestModule = {}

function TestModule.Init(vargs)
	if (vargs.bool) then
		TestModule.example = function(arg1, arg2)
			return {arg1, arg2}
		end
	else
		TestModule.example = function(arg1)
			return true
		end
	end
end

return TestModule

I’ve set the bool to false, but it yet suggests me the first function that was ever declared where there can be two arguments.


And I am not sure if I am doing this wrong, in terms of structure or design. But I am trying to showcase something with the “auto suggestion”.

Here are the examples that I mentioned here. There can be more, but I showcased two where the “Auto Suggestion” or “Auto Complete” would fail.

auto_suggestion_examples.rbxmx (6.0 KB)


Are there any tools or something that get used where the auto complete is better? I ask this because, I was wondering regarding the developing of MainModules that use a Config and Loader.

As example, Adonis Admin System.

In Roblox, as in many programming languages, it’s important to prescribe specific types of arguments for functions in order to ensure that your code runs as expected. This practice is known as type checking or type annotation. There are several reasons why specifying argument types is beneficial:`

Many code editors, like Roblox Studio’s Lua editor, can provide helpful autocompletion and error checking based on type information. This can lead to a more efficient and less error-prone development process.`