LuaLS / LuaLS/lua-language-server
[Feature Request] Automatically overload with `__call` metamethod.
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
There is already custom behavior when __index is defined in a metatable, why not __call? You can manually define the overload, but then you have to define the signature twice.
---@overload fun(a: string, b: number): boolean
local foo = setmetatable({}, {
---@param a string
---@param b number
---@return boolean
__call = function(a, b)
return true;
end
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing automatic behavior for metatables with __index, then compare it with the __call example in the issue. Done means a callable metatable's function signature is inferred without repeating an @overload declaration, with coverage for the string-and-number example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100