LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.38k stars 319 forks source link

feat: infer function param when the function is passed as call arg #2946

Closed tomlau10 closed 2 weeks ago

tomlau10 commented 2 weeks ago

closes #2695 (the feature request by me, finally I have the knowledge to implement myself 🙂 )

Example Use Case

---@param callback fun(a: integer)
function register(callback) end

local function callback(a) end  --> a: integer
register(callback)

which is similar to existing infer behavior with function literal:

register(function (a)  --> a: integer
end)

中文版

實現思路