Skip to content

No completions for function aliases #3135

Closed
@musjj

Description

@musjj

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Type Checking

Expected Behaviour

Global function aliases are typechecked.

Actual Behaviour

Global function aliases are not typechecked.

Reproduction steps

---@class foo
foo = {}

---@alias foo.bar fun(baz: number)

foo.bar = function(baz) -- (parameter) baz: any

end

function foo.bar(baz) -- (parameter) baz: any
 
end

The field bar and argument baz should be inferred, but it's not.

Additional Notes

I'm not sure what's supposed to be the correct behavior here. But this is how they're defined in the https://github.com/LuaCATS/love2d plugin:

-- version: 11.5
---
---[Open in Browser](https://love2d.org/wiki/love)
---
---@class love
love = {}

---
---Callback function used to update the state of the game every frame.
---
---@alias love.update fun(dt: number)

And this breaks all completions for these functions: LuaCATS/love2d#10.

Was there a breaking change somewhere?

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUser has a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions