lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Make function types (and aliases) recognize the parameter types like with `@param`

Open filloax opened this issue 3 years ago • 0 comments

I'm making an extension for an API with callbacks that take functions with specific arguments, and being able to do this:

---@alias MC_PRE_ENTITY_SPAWN fun(type: EntityType, variant: integer, subType: integer, position: Vector, velocity: Vector, spawner: Entity?, seed: integer): table?

---@type MC_PRE_ENTITY_SPAWN
local function myCallback(type, variant, subType, position, velocity, spawner, seed)

end

and have the language server recognize the many params like if this were done:

---@param type EntityType
---@param variant integer
---@param subType integer
---@param position Vector
---@param velocity Vector
---@param spawner Entity?
---@param seed integer
---@return table?
local function myCallback(type, variant, subType, position, velocity, spawner, seed)

end

would be very handy for user friendliness.

filloax avatar Jul 24 '22 10:07 filloax