Skip to content

Function assigned to field should be completed as function #1573

Open
@carsakiller

Description

@carsakiller

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Completion

Expected Behaviour

When providing an alias for a function in a table, the alias should be treated as a function.

Actual Behaviour

When providing an alias for a function in a table, the alias is treated as a field and does not get completed as a function. Hover shows that the field is a function, but completion does not agree or complete with parentheses.

image

Reproduction steps

  1. Use the below code
---@class myTable
local t = {}

---Does a thing
---@param a integer
---@param b string
---@param c boolean
function t.myFunc(a, b, c) end
t.myAlias = t.myFunc
  1. Try to get completions for the function t.myAlias

Additional Notes

This would be incredibly useful for aliasing a function — something that luassert does a lot.

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions