LuaLS / LuaLS/lua-language-server

[Feature Request] Support capturing generic type for @overload

Open
#3,190 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description


---@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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Lua example and trace how the language server processes the @generic and @overload annotations for a table with a metatable.__call. The work is done when the generic type T is captured from the overload argument and the returned value is inferred as T for this pattern.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.