pico-api is a definition file used to enable LSP(Language Server Protocol) support to PICO-8 and Picotron.
How to
- Install and enable sumneko/Lua extensions in VSCode Marketplace
-
New a folder .vscode in your workspace, and put the file setting.json into it
-
Change the field Lua.workspace.library in .vscode/settings.json to the path to the folder picotron(or folder pico8, depending on the type of your project)
- New a cartridge and use this snippet at the top of its code:
-- picotron cd("/myproj") include("main.lua") -- pico8 #include main.lua |
Then you can write code in the workspace of VSCode and enjoy code prompts, formatting, AI copilot, etc.
Issues
Picotron Shorthand is not supported.
> UPDATE: Thanks to @arnaught. !=
operator and shorthand assignment operators like +=
can be used now.
This is a very rough version. If you have any questions, please raise them in the repo issue or comment directly here. You can also add and modify definitions in the file yourself.
link
https://marketplace.visualstudio.com/items?itemName=sumneko.lua
This is cool! I've been working on basically the same thing: https://github.com/Rayquaza01/picotron-definitions
Worth noting this doesn't just work with VSCode, but any editor that can use Lua Language Server.
Shorthand can be partially supported with changes to the .luarc.json / settings.json file. I believe Lua LS supports all of the shorthand assignment operators Picotron uses except ..=
. You can also disable some of the builtin modules that aren't available in Picotron. See this as an example: https://github.com/Rayquaza01/fuzzy-finder-picotron/blob/main/.luarc.json
[Please log in to post a comment]