Skip to content

Support auto complete of callback arguments #460

Closed
@gotschmarcel-ni

Description

@gotschmarcel-ni

It would be awesome if functions that get passed as arguments (directly or via tables) to other functions get autocomplete for their argument types.

Examples

Directly pass a callback function to other function

---Work hard
---@param callback fun(value: number)
function work(callback)
    callback(22)
end

work(function (value)
  -- No autocomplete for value here
end)

or via custom table:

---@class work_item
---@field complete fun(value: number)
local work_item = {}

---Work hard
---@param item work_item
function work(item)
  item.complete(42)
end

work {
  complete = function (value)
    -- No autocomplete for value here
  end
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions