Skip to content

love2d enum is declared as class #902

@MikuAuahDark

Description

@MikuAuahDark

Describe the bug
LOVE enum types are declared as table in the libraries. For example, love.KeyConstrant in love.keyboard.lua is supposed to be enum like this

---@alias love.KeyConstrant '"a"' | '"b"' | '"c"' | (and so on)

But instead it's a class.

---@class love.KeyConstant
---@field a integer
---@field b integer
---@field c integer
(and so on)

Expected behavior
LOVE enums are literal string, so it makes sense to use

---@alias EnumName '"enumvalue1"' | '"enumvalue2"' | '"enumvalue3"' | (and so on)

Screenshots
https://github.com/sumneko/lua-language-server/blob/141f5d98b593a4eb2c626e2219ac33d91a524a1d/meta/3rd/love2d/library/love.keyboard.lua#L81-L94

I'm sure it happends on other LOVE enums too.

Environment (please complete the following information):

  • OS: Any (Not Applicable)
  • Is WSL remote? Any (Not Applicable)
  • Client: VSCode

Provide logs
Not Applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions