Log In  


I made definition files so that LSP can support pico8/picotron's library functions and special syntax, so that pico8/picotron programs can be written in external editors such as VSCode while getting the help of various modern features.

How to

  1. Install and enable sumneko/Lua extensions in VSCode Marketplace
  1. Download pico-api

  2. New a folder .vscode in your workspace, and put the file setting.json into it
  1. 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)
  1. 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

https://github.com/ahai64/pico-api

4


1

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]