[Update Nov 6, 2023]
Panic has given permission for me to share this project. You can find it here: GitHub - balpha/playdate-types: Type annotations for the Playdate Lua SDK
[Original post follows]
TL;DR
I'm working on a Lua type annotation file which (at least in VS Code) gives you improved autocompletion, optional type checking, and documentation on hover for the various SDK functions.
It's still work-in-progress, but it's already in a state were I find it very helpful. Therefore, I would like to share this file with the community soon.
However, because this file is generated from the SDK documentation (in particular contains a lot of text from Inside Playdate), I cannot make it public without express permission from Panic.
Because I'm hoping that Panic won't have any problems with this, but I just need them to state it explicitly, I thought I'd use the forum for this.
In addition, if anyone else has thoughts/feedback on the idea of this type annotation file, I'd love to hear about it as well!
The long version
The file __stub.lua
included as part of the SDK contains stub function definitions for many of the SDK functions. But it doesn't contain everything (e.g. it's missing the various constants like kColorBlack
), has no type information for function parameters or return types, and has no built-in documentation that could be shown by the IDE.
My file __types.lua
can be dropped in the same folder as __stub.lua
, and the Lua language server (which is used by VS Code) will immediately pick up the information and make it available for development.
Here are two example screenshots of the same code with and without my type file:
This type annotation file is generated from the "Inside Playdate" file through a mix of automation and manual intervention.
In particular, in order to show the function documentation, it includes a significant amount of the text from "Inside Playdate" verbatim.
The SDK License says that
You will not: [...]
- Modify, adapt, alter, translate, or incorporate into or with other software or create a derivative work of any part of the SDK, except as permitted herein, without express written permission from Panic
and my __types.lua
file clearly falls under this provision.
I would love to get your (Panic's) permission to publish the file on GitHub.
I was thinking of a blurb along the lines of this:
The file
__types.lua
("the File") was generated by Benjamin Dumke-von der Ehe ("the Author") based on the SDK documentation, which is published by Panic Inc. under the Playdate SDK License. Panic is not involved in the creation of the File and does not take any responsibility for its completeness or correctness. But Panic has given permission for this file to be published by the Author, and for the File to be used by anyone, as long as it's used under the same conditions as the Playdate SDK itself, as laid out in the Playdate SDK License.
Is that okay?