Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

love2d enum is declared as class #902

Closed
MikuAuahDark opened this issue Jan 12, 2022 · 0 comments
Closed

love2d enum is declared as class #902

MikuAuahDark opened this issue Jan 12, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@MikuAuahDark
Copy link

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

@sumneko sumneko added the bug Something isn't working label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants