Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - How to test the definition? #1

Open
PJaros opened this issue Mar 24, 2021 · 3 comments
Open

Documentation - How to test the definition? #1

PJaros opened this issue Mar 24, 2021 · 3 comments

Comments

@PJaros
Copy link

PJaros commented Mar 24, 2021

I'm unsure what the definitions provide with a fresh installed vs-vode. So I'm unsure even it even does work or not.

  • How is the code-completion activated (Ctrl-Space)?
  • Does it provide syntax-highlighting too (or did you use a different extension for that)?

I've tried the https://github.com/peabnuts123/pico8 example both with Ubuntu 18.04 and Windows 10 with the latest vs-code. I get the same result on both os: No syntax-highlighting and no pico8-specific code-completion.

The "sumneko.lua" extension was suggested running the first time (I've installed it of course). I have trouble using the "launch.json" because of the '"type": "coreclr"' which I can't pin down to any specific extension. I'm unsure if this related to the problem above.

@PJaros PJaros changed the title How to test the definition? Documentation - How to test the definition? Mar 24, 2021
@peabnuts123
Copy link
Owner

Thanks for the feedback 🙂 Looks like I've got some junk lying around in that pico8 repo. CoreCLR is from the C# extension - it is just a hack to make the launch.json run an arbitrary executable (that whole repo also only runs on Windows atm which is ... suboptimal). So yeah sorry you mightn't have much luck with that repo! It is a bit of a dumping ground atm.

As for getting the definitions going, they have an undocumented limitation at the moment that you cannot edit directly in the .p8 file, you have to use an #include something.lua and then write your code in a separate lua file. That limitation is mostly because the Lua language server doesn't run for .p8 files. I am yet to have a look to see if I can get a setup running for .p8 files directly.

Lastly no these are JUST completion definitions for EmmyLua. So you need that in order to use it. As mentioned the sumneko.lua extension provides that, as well as syntax highlighting and language features for Lua. It's my recommendation for editing Lua in vscode.

Circling back to my first point, if you want to edit the .p8 file directly you will need one of the pico8 extensions found on the marketplace. This is the one I have installed but as the Lua language server doesn't actually run in this context (unless I can figure out how to achieve that) then it is little more than syntax highlighting, and not very useful.

TL;DR

  • Sorry, my pico8 repo is a mess
  • You cannot use these definitions yet with editing .p8 files directly, you need to use an #include
  • You need an extension for vscode to work with Lua in the first place, I recommend this one.

@PJaros
Copy link
Author

PJaros commented Apr 3, 2021

Thank you for your feedback.

I'm currently trying to break down my 500+ lines-of-code "game" into something more managable, thus I don't mind editing lua-files instead of a p8-file.

I am willing to learn some C# if necessary. C# is supported with Mono on Linux and MacOS. It's just that I'm neither an expert on C#, lua, p8 or js so these are hurdles which slows my progress configuring a good editor and build system.

@peabnuts123
Copy link
Owner

I'm currently trying to break down my 500+ lines-of-code "game" into something more managable, thus I don't mind editing lua-files instead of a p8-file.

I agree with the sentiment implied here - it's probably better practise to code your game in a series of files that are all "included" instead of just editing everything in the pico8 editor / .p8 file. It might not be quite in the spirit of PICO8 but I think it is worth the tradeoff of having a maintainable project!

I am willing to learn some C# if necessary. C# is supported with Mono on Linux and MacOS. It's just that I'm neither an expert on C#, lua, p8 or js so these are hurdles which slows my progress configuring a good editor and build system.

I assume this is in reference to the C# extension. I may not have been clear in my earlier reply - the reliance in the C# extension was a complete oversight by myself. I didn't stop to realise that coreclr is a C# "launch type". You simply need to have the extension (and to be running on windows) for that launch configuration to work. It has a dependency on the C# extension but does use C# to any degree haha. It's a complete mistake. Sorry for that or any confusion there! Try installing it and give it a go if you'd like to get it working.

However, you should still have Lua and PICO8 autocomplete/intellisense options when editing a .lua file in that repo even if you don't have that C# extension installed. Let me know if you don't!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants