Skip to content

Support auto complete of callback arguments where callback is defined via a local variable #2695

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
tomlau10 opened this issue Jun 6, 2024 · 0 comments · Fixed by #2946
Closed

Comments

@tomlau10
Copy link
Contributor

tomlau10 commented Jun 6, 2024

I think this is somewhat similar to #460, where the difference is that the callback is defined as a local variable.

Example

Using the sample code in the above issue to illustrate the situation:

---@class Class
---@field x number
---@field y number

---@param callback fun(value: Class)
function work(callback)
end

local function f(value)
    value.$  -- no autocompletion here
end
work(f)

It would be great if f can be inferred automatically (given that f is not already manually annotated of course).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant