lua-language-server
lua-language-server copied to clipboard
Annotation/documenting issue
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?
Annotations, Type Checking
Expected Behaviour
Method 1: love.graphics.newQuad( x, y, width, height, sw, sh ) Method 2: love.graphics.newQuad( x, y, width, height, texture )
There are two way's to use newQuad, so it does not complain when I use Method 2
Actual Behaviour
Since only love.graphics.newQuad( x, y, width, height, sw, sh ) is defined it will complain if you use Method 2
Reproduction steps
Additional Notes
possible solution
---@param x number # The top-left position in the Image along the x-axis.
---@param y number # The top-left position in the Image along the y-axis.
---@param width number # The width of the Quad in the Image. (Must be greater than 0.)
---@param height number # The height of the Quad in the Image. (Must be greater than 0.)
---@param ... number|love.Image # The reference width & height or derived from quad. (Must be greater than 0.)
---@return love.Quad quad # The new Quad.
function love.graphics.newQuad(x, y, width, height, ...) end
Log File
No response
The meta files are generated from https://github.com/love2d-community/love-api, please open an issue there.
Refer to: https://github.com/love2d-community/love-api/blob/17bcdfc7beda6848a94aa42d6914d5c393b1752a/modules/graphics/Graphics.lua#L2695-L2741
Fixed in love2d-community/love-api@2d810ed2be76a28d2d4901d255afb26efaaa4a83.
Still present in v3.7.4 on Windows. The VSIX and release packages are both missing the overload.
---@overload fun(x: number, x: number, width:number, height: number, texture: love.Texture):love.Quad
It seems the repo that's scraping the Löve2d Wiki is scraping an outdated version. love-api has the correct stuff in recent versions, but luals is not using a recent version for its generated data On the Löve2d Wiki you can see there are two versions of newQuad: https://love2d.org/wiki/love.graphics.newQuad quad = love.graphics.newQuad( x, y, width, height, sw, sh ) quad = love.graphics.newQuad( x, y, width, height, texture )
Is the love-api has outdated signature? If so, please send PR to https://github.com/love2d-community/love-api thanks.
love-api has been updated to have the correct newQuad variants last year (from https://github.com/LuaLS/lua-language-server/issues/1913#issuecomment-1532829295), and this repository is pointing to a commit of it that's recent enough to have that change.
But this repository doesn't just use love-api, it uses generated data based on that. And while that has been updated in the last few months in the LuaCATS repository, the lua-language-server's submodule for LuaCATS (in meta/3rd
) has not been updated with that change.
So maybe all that needs to change to solve this issue is for this repository to update its LuaCATS submodule? I also wonder if some of that process could be automated, because there seem to be a lot of manual steps here that people aren't doing very often.
The included addon has been updated, as well as the one available in the addon manager.
This should be fixed now 🙂