Is there any way to program a editor tip

Hello guys,

Is there any way to build your own editor tip? When you use a Roblox’s built-in functions, there is a little editor tip or code tip to guide you on how to use it. “E.g, This function uses two parameters”.

I have built my own functions within a modulescript. Although it is self-explanatory because of the name but I would like to see the editor tip or code tip when I type it out again within the script.

Is there anyway to do this?

getPlayerService.PlayerAdded:Connect(function(player)
	moduleScript:createLeaderstats(player)
	moduleScript:AddPlayerToTable(moduleScript.players.generalPlayers, player)
	moduleScript:loadPlayerData(player)

	local leaderstats = player:WaitForChild("leaderstats")

	player.CharacterAdded:Connect(function(character)
		leaderstats.coins.Changed:Connect(function()
			moduleScript:savePlayerData(player)
		end) 
		leaderstats.wins.Changed:Connect(function()
			moduleScript:savePlayerData(player)
		end)
	end)
end)

The editor tip and examples are copied directly off of Roblox’s Documentation Website, so it’s pretty much impossible to create a code tip for your function.

However, you can use Type Checking, in which the editor tip window will display what the parameter’s value should be.

local module = {}

function module.Foo(a: number, b: number): number
	return a + b
end

return module

So, when getting the declaration for the function Foo, this appears:

Screenshot 2024-02-20 205738

This shows that a and b must be a number, and that the function returns a number as well.

Note that no syntax errors show whenever you use this feature.

If you meant something like Python docstrings, Roblox does not have those. I wish it did.

Best thing you can have is defining the types of the arguments so you’ll see the types while using your functions.

Some Roblox VSC extensions have this feature.

Thank you kexy123. I will look into using that. When I see other people’s code, when they use this, I always wonder why they use this method and it confuses me. Your explanation helps me to understand why they choose to use this.

1 Like