lua-language-server
lua-language-server copied to clipboard
Function assigned to field should be completed as function
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.

Reproduction steps
- 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
- 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
Might be related to https://github.com/sumneko/lua-language-server/issues/1533
Current implementation:
local t = {}
t.f = function () end
t.f = function (x) end
t.f = function (x, y) end
t.f --> Shows 3 items `f()`, `f(x)` and `f(x, y)` here, based on 3 `setfield`
t.g = t.f
t.g --> Only have 1 `setfield`, I can not expand it into 3 items
Need to refactor.