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

[Feature Request] Support capturing generic type for @overload

Open amsitlab opened this issue 6 months ago • 3 comments


---@class base

---@class builder
---@generic T: base
---@overload fun(name: `T`): T
local builder = {}

local function __call(self, name)
....
end

setmetatable(builder, { __call = __call })

Thats will be helpfull for table have an metatable.__call

amsitlab avatar May 20 '25 22:05 amsitlab

this has long been feature requested: https://github.com/LuaLS/lua-language-server/issues/723

tomlau10 avatar May 21 '25 13:05 tomlau10

I think the grammar should like:

---@class builder
---@overload fun<T>(name: `T`): T
local builder = {}

CppCXY avatar May 22 '25 12:05 CppCXY

I think the grammar should like:

---@class builder ---@overload fun<T>(name: T): T local builder = {}

thats awesome look like c++ template

amsitlab avatar May 22 '25 15:05 amsitlab