Skip to content

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

Closed
@tomlau10

Description

@tomlau10

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions