Coder Social home page Coder Social logo

vscode-playdate's Introduction

VS Code Playdate

Adds a custom command to compile your code and run it in the Playdate Simulator.

screenshot

Getting Set Up

Since this plugin will need to access both pdc (the Playdate compiler) and the actual simulator which is bundled in the SDK the plugin needs to be able to determine where that is installed.

Either configure your environment variable PLAYDATE_SDK_PATH (will always take precedence) or add it in the settings/launch config. While in the settings it's also a good idea to add the Lua workspace libraries:

{
  "Lua.workspace.library": [
    "/path/to/PlaydateSDK/CoreLibs"
  ]
}

Command palette

command palette

To compile and run your code in the simulator through the command palette, hit Cmd + Shift + P on Mac or Ctrl + Shift + P on Windows/Linux and look for "Run app in Playdate simulator".

By default, the plugin will use source as source argument and output.pdx as output argument (note, these are case sensitive). If you want to use a different source or output, add the following to settings.json:

{
  "playdate.source": "Source",
  "playdate.output": "Output.pdx",
  // Optionally set sdkPath if not PLAYDATE_SDK_PATH is configured.
  // "playdate.sdkPath": "/path/to/PlaydateSDK"
}

They will both be relative to the workspace root.

Run as debugger

This plugin can also be configured to run as a debugger and launch the simulator by hitting F5 (or your configured key). To use it this way create the following .vscode/launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "request": "launch",
      "type": "playdate",
      "name": "Run app in Playdate simulator",
      "source": "${workspaceRoot}/source",
      "output": "${workspaceRoot}/output.pdx",
      // Optionally set sdkPath if not PLAYDATE_SDK_PATH is configured.
      // "sdkPath": "/path/to/PlaydateSDK"
    }
  ]
}

Notes

The playdate version of Lua has a few extras:

  • The import function
  • += and -=

To make VS Code not mark these as invalid syntax you can add the following to your settings.json:

"Lua.runtime.nonstandardSymbol": [
  "+=",
  "-=",
  "*=",
  "/="
],

vscode-playdate's People

Contributors

bombsimon avatar lunarcloud avatar maxfriedrich avatar orta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-playdate's Issues

Update launch arguments to the expected values

Panic engineer here. :)

When using this extension the Launch Request arguments are not using the expected keys. They are currently are "source" and "output".

The Simulator expects "sourcePath" and "gamePath" and optionally "sdkPath".

Please let me know of that doesn't make sense, thanks!

Code for 0.9.3 / Tag old releases

Hi,

I noticed the version posted the VSCode marketplace (0.9.3) is newer than the code here. I assume this is because you published a release but forgot to git push or just forgot to commit package.json altogether.

@orta Can you true-up this repo so it includes the code for versions published?

image

Would you be willing to tag releases going forward?

It's easy enough to backfill old tags too:

git tag v0.9.2 000ff8a
git tag v0.9.1 a941f2f
git tag v0.9.0 79107e8
git tag v0.0.7 311c95b
git tag v0.0.6 a7ab6f2
git tag v0.0.4 a8c2f50
git tag v0.0.2 6f65e80
git tag v0.0.1 cebacc2
git push --tags

launch.json instructions don't work

Seems something changed with the VSCode spec because I get the errors that "source" and "output" are not valid so per your instructions, the launch.json and tasks.json files don't work. I'm not actually sure how to fix this myself unfortunately.

"Windows cannot find '**undefined**/main.pdz"

Using the 0.0.5 version of the extension, I get an error after running the debug command:
"Windows cannot find 'undefined/main.pdz"

But the simulator still launches afterwards, and working as intended

My project is based on this template https://github.com/Whitebrim/VSCode-PlaydateTemplate with no edits to any of the json files under .vscode.

This is not a critical issue, but took me sometime to narrow the issue to the extension and not my machine!

Thanks for the great plugin, and let me know if more details or files are needed!

can't able to re-configure source & output path

When I tried to configure the new paths, the vscode is saying, these options are invalid.

Also, these options are not considered while running the extension. So I can't able to re-configure the path and use this extension. I am right now renamed my folder from src to source to run this.

Any help will be appreciated

I am using the latest playdate sdk.

Screenshot 2022-07-25 at 12 15 26 AM

jae@mac Contents % pdc --version
1.12.2
jae@mac Contents % 

launch.json Warnings

Creating launch json as docs suggested work fine, but I am getting a warning. Doing a bit google research, it seems to suggest the plugin schema needs updated? Any help would be appreciated. I realize its only cosmetic, but hate distracting warnings.

Screen Shot 2022-05-14 at 11 22 45 AM

Unclear error message: "failed to compile project"

Getting the following error when I attempt to Run App in Playdate Simulator from the VS Code command (accessed via cmd + shift + P).

vscode-playdate: Failed to compile project.

Source: Playdate (Extension)

I'm clueless as to what to do from that. The paths look correct in the settings.json.

I had it working last night but after updating the Playdate SDK from 2.0.1 to 2.0.3 I'm just getting this error instead.

"Run App" command failure output

Is there a place where the output of the "Run app" command is logged? I'm having some issues with compilation errors, but don't know what they are. I'm able to compile and run the app in the simulator via the terminal, but the command is failing for me.

Linux Support

I was wondering why this silently failed for me, until i saw the code: it checks 'process.platform' for 'win32' or 'darwin'
but really, every non-windows platform should work with the code you specified as macOS-only (darwin).

If you could make this a simpler if-else, it would likely work for me here on Linux.

Can't open the simulator on Windows

Thanks for this plugin that helps with Playdate development!

The current version unconditionally spawns open args.output when using the playdate launch type. This works well under macOS but no for Windows.

If I want to open my built application from a terminal in Windows it seems like my best shot would be start args.output/main.pdz where args.output is the Output.pdx.

Would file a PR but I've never written a VS Code plugin and not sure what the best workflow for building and testing is. If this is something you think should be supported and you need help I can do some digging and file a PR.

Build Task Speed

Hi there. Thank you for the program and tutorial! Was wondering if it'd be possible to speed up the task.json? Right now it's taking about 8 seconds to complete for me.

I notice it closes and then reopens the simulator, which seems to take a large chunk of the time. Would it be possible to have it check for an existing simulator and run the program from that one instead, and only open a new instance if there is none?

Also if there was a way improve the deleting of files? Right now that takes at least 2 seconds which seems excessive.

I'm personally looking into modifying mine and if I find an improvement will be sure to share, but was wondering if had any thoughts on the matter. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.