CoreLibs EmmyLua documentation for sumneko LSP

Hi thanks for all the SDK documentation in general it's been very easy getting going a day after I got my playdate :slight_smile:

One idea though, if you were to add EmmyLua style documentation to the lua files in CoreLibs, people who are using sumneko_lsp (neovim users for sure, and I think microsoft vscode too?) would get a lot of help.

For example now in neovim I can get this, which is pretty good

please look a the top part of the image later on

but with a few comments on that method in __stub.lua

---Draws the filled rectangle r or the rect at (x, y) of the given width and height.
---@param x integer|rect #starting x position or rect
---@param y integer #starting y position
---@param width integer #width of rectangle
---@param height integer #height of rectangle
function playdate.graphics.fillRect(x, y, width, height) end

it has a lot more help

please look at the bottom part of the following image

(sorry for having a screenshot of screenshots but after pressing create thread I found out that uesrs on this site can't post two screenshots in a single post)

Then also you can make sure that callback functions have the right paramters, you're not passing table in when it should be a string, even any functions that take tables, that those tables have the proper items. Just a ton of nice quality of life things the LSP can do if it has more information.

8 Likes

I had started working on this privately (I have types for playdate.graphics, playdate.file and playdate.geometry for now). Perhaps this could be a community-maintained thing?

4 Likes

I find the file 'PlaydateSDK\CoreLibs__stub.lua'
And not find the function 'getCrankPosition'.

Perhaps miss many functions...

Hello, where can we find this ? It would be super useful to us (small team of 3 building a Playdate game) currently learning the SDK to have some kind on LSP hints for the SDK.

Try Playdate-LuaCATS: VSCode autocomplete, types and inline Playdate SDK documentation

1 Like