GithubHelp home page GithubHelp logo

midouest / vscode-playdate-debug Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 4.0 1.57 MB

Unofficial Playdate debug extension for Visual Studio Code on macOS, Windows and Ubuntu

Home Page: https://marketplace.visualstudio.com/items?itemName=midouest.playdate-debug

License: MIT License

TypeScript 99.05% Shell 0.95%
debugger playdate playdate-console vscode vscode-extension

vscode-playdate-debug's People

Contributors

mark-lacroix avatar midouest avatar ncocchiaro 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

Watchers

 avatar  avatar  avatar

vscode-playdate-debug's Issues

Build error with relative paths

When executing the "Debug" action, building the game and running it in the simulator, if any files contains an import with a relative link to a parent folder, this will lead to the build failing with this error:

Compiling...
> "D:\PlaydateSDK\bin\pdc" -sdkpath "D:\PlaydateSDK" "d:\PlaydateSDK\Examples\ExtensionError\source" "d:\PlaydateSDK\Examples\ExtensionError\source.pdx"
Command failed: "D:\PlaydateSDK\bin\pdc" -sdkpath "D:\PlaydateSDK" "d:\PlaydateSDK\Examples\ExtensionError\source" "d:\PlaydateSDK\Examples\ExtensionError\source.pdx"
error: d:\PlaydateSDK\Examples\ExtensionError\source/main.lua:5: No such file: ../test

My test setup is simple:

test.lua
source
|__main.lua
|__game.lua

with a simple print in both "game" and "test" and the "main.lua" files contains this

import 'game'
import '../test'

Building the game manually with pdc works as expected

I am using Window 10, and this has been my only issue so far with it

set the entry point manually instead of using currently opened file for run/debug

Is there any option to launch a particular lua file (for example main.lua) instead of the one currently opened in editor ?
That would be super convenient when working in multiple file projects, since now the Run command
launches the one that's currently opened in the editor and it's kind of cumbersome to always manually switch to
the main file (containing playdate.update loop).
Not sure if it's possible to configure somehow now or it's more like a feature request, anyway any feedback would be much appreciated :) !

Breakpoints no longer work in VSCode 1.73.x

Breakpoints (both regular breakpoints and break-on-exceptions) fail to work in Visual Studio Code 1.73.0 and 1.73.1

Not sure if this is the cause of the break, but there do appear to be changes to the debug adapter protocol in 1.73? Not sure if this is something that needs adjustment in this extension, or something needing updating in the simulator itself.
https://code.visualstudio.com/updates/v1_73#_debug-adapter-protocol

For now, workaround is to roll back VSCode to 1.72 (September 2022) or earlier.

This thing randomly stops working all the time for me

It works perfectly fine, but once in a while I'll go click the 'debug file in playdate simulator" and nothing happens at all. Any tips on fixing that? Re-installing doesn't seem to fix the issue, nor does restarting. I'm on MacOS, VSCode v1.69.0. I can build and run the file just fine in the PlayDate SDK CLI.

main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx

Odd bug. Often times when I go to debug it'll give me an error saying...

"error: file copy (main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/tilemaptest.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/main.pdx/assets/Bitmore-Medieval.pft) failed: errno=2"

My work around has been to go to the main.pdx, delete it. then start the debug again.

Debugging C projects

Hi,

Would it be possible to debug projects written in C? I'm using the Sprite Game example from the SDK's C_API directory to test with it, and while I can get a debug build running in the simulator, attempting to launch the game with this extension causes it to exit silently (neither the simulator console nor the client/server debug log generated by the extension give any indication as to why).

My understanding is that this extension only supports Lua projects, so I'm not surprised it doesn't work for C, but I'd like to know what it would take to add support for that. Happy to contribute with a PR if you can give me some pointers!

Thanks

relative path in settings

Looks like the path in settings must be absolute as it tries to open from the installation folder of vscode if you set a relative path.

Is it possible to use a relative path from the project folder and not from vscode folder?

I'm on Windows if that helps.

Debug stops attaching, only fixed with a system restart

I'm on Windows.
The debug works fine for a while but at some point it stops attaching. (Pretty randomly thus far, once it was after I put the system to sleep and woke it back up a few hours later)

The tasks are executed correctly and the simulator is launched but the debugger can't attach to it and fails.

 *  Executing task: Playdate: Build 

Compiling...
> "~\PlaydateSDK\bin\pdc" -sdkpath "~\PlaydateSDK" "~\project\source" "~\project\Project.pdx"
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: Playdate: Run 

Checking for running Playdate Simulator...
> tasklist
Starting Playdate Simulator...
> "~\PlaydateSDK\bin\PlaydateSimulator.exe" "~\project\Project.pdx"
 *  Terminal will be reused by tasks, press any key to close it. 

One difference I found is that when the debugger works you can keep the simulator open and it replaces the build on the fly before attaching to the process, but once it stops attaching it also stops replacing it, so the first time it runs the simulator and starts the project (but doesn't attach) and subsequent launches (task Playdate: Run) don't do anything at all unless you close the simulator.

There error I get doesn't say much.
image

SDK versioning or other solutions?

Hi,

Is it possible to change the version of the PlaydateSDK?

Or could I point to an external folder that contains a newer copy of the PlaydateSDK? (that I manage myself).

Or any other ideas? I'm very new to programming for the Playdate.

Thanks!

selectively disable workarounds

As a developer, I want to be able to selectively disable some workarounds while others are enabled, so that I can disable workarounds that have been fixed without having to push a new release.

pdc task fails to build a source folder with no pdxinfo

Reproduction

  1. Open the Examples directory in the PlaydateSDK
  2. Configure the pdc task in the root of the project
{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "pdc",
      "problemMatcher": ["$pdc-lua", "$pdc-external"],
      "label": "Playdate: Build"
    },
  ]
}
  1. Configure the project sourcePath and outputPath in the project settings
{
  "playdate-debug.sourcePath": "/Users/midouest/Developer/PlaydateSDK/Examples/Asheteroids/Source",
  "playdate-debug.outputPath": "/Users/midouest/Developer/PlaydateSDK/Examples/Asheteroids"
}
  1. Run the pdc task

Expected

The source folder is compiled without a pdxinfo

Actual

The pdc task fails to compile the folder with the following error:

Could not read pdxinfo file at /Users/midouest/Developer/PlaydateSDK/Examples/Asheteroids/Source/pdxinfo

pdc task should auto-increment buildNumber in pdxinfo file

The Playdate hardware will not download new side-loaded builds unless the pdxinfo's buildNumber property has been incremented.

The pdc task could automatically increment the buildNumber property. This would mean that the developer no longer needs to remember to increment the buildNumber themselves before side-loading the new build.

Dev Notes

The best place to make this change is probably the PDCTaskRunner. The ConfigurationResolver already reads the pdxinfo contents, so we may just want to parse and return the build number there.

We should also add a new configuration property to the pdc task that enables or disables this behavior.

This work may end up conflicting with #8 due to the changes to PDCTaskRunner and ConfigurationResolver.

Extension is unavailable in VSCodium

Just spun up my first Playdate project and this extension makes the whole development process extremely smooth, so thanks for that!

I was wondering if you'd consider publishing it to the open-vsx.org as well? I use VSCodium on Linux, which is prevented by Microsoft's terms of service from accessing Microsoft's extension marketplace. (You can hack it to do it anyway, which is how I tried this out, but it's not a great experience.) open-vsx seems to be the standard open extension repository for non-Microsoft builds of VS Code; my Linux distro has multiple different VS Code-derived packages that use it.

https://github.com/eclipse/openvsx/wiki/Publishing-Extensions has the details, but once you're set up with an account and an access token, it looks like it should be as straightforward as using ovsx publish alongside vsce publish.

Thanks!

Support sdkPath, sourcePath, outputPath and productName properties on task/launcher configuration

The task and debug launcher configurations now support passing certain workspace-level properties through the task/debug configuration. This was done because we needed to override any possible workspace configuration to support "Run/Debug file in Playdate Simulator".

We could take this a step further and officially support these properties on each task/launch configuration. We could also update the ConfigurationResolver to skip resolving data from the filesystem if these variables are already configuration.

This would benefit users because we would allow more flexibility in how tasks are configured within the project, and there would be a small performance improvement from skipping filesystem access when the configuration is already provided.

settings option to build to $PLAYDATE_SDK_PATH/Disk/Games

Building or moving a compiled .pdx game to the Disk/Games directory in the Playdate SDK is a common way of testing a game's launch image.

The extension could support this workflow by exposing a boolean property that causes the output path to be <sdkPath>/Disk/Games, where <sdkPath> is the Playdate SDK installation directory as resolved from the environment/workspace settings. Enabling this property would override the setting for playdate-debug.outputPath, if present. We could also set this using the outputPath configuration, either by supporting variable replacement, using a special string, or using a configuration object instead of a string.

Some examples of possible configurations:

{
  "playdate-debug.outputToGamesFolder": true
}
{
  "playdate-debug.outputPath": "${playdateSDKPath}/Disk/Games}"
}
{
  "playdate-debug.outputPath": {
    "sdkGamesFolder": true
  }
}

IncrementBuildNumber can write undefined keys to PDXInfo file

When using the incrementBuildNumber option, all PDXInfo keys are output to the PDXInfo file, including optional ones that may have originally not been included. In my case, I don't have the ContentWarning fields in the file, but they get added anyway when my project builds, as follows:

contentWarning=undefined
contentWarning2=undefined

Perhaps this could be fixed by replacing this line with something like this:

  const lines = [];
  for (const key of keyOrder) {
    const value = pdxInfo[key];
    if (value !== undefined) {
      lines.push(`${key}=${value}`);
    }
  }

or with a schema change. However due to my limited familiarity with the TypeScript ecosystem I ran into issues running tests for the extension as well as getting around an error from a pre-commit hook, so I couldn't quite get to verifying and/or PRing in any of those options. I'm happy to leave it to the experts if this is deemed a valid issue :)

subsequent run command does not upload new code to simulator

It seems that subsequent run commands do not upload new pdx
onto the console, the simulator seems to get restarted / refreshed but
it's running old version of the code. Right now I need to manually click the
"stop debug session" icon before running it again, which I guess is not really
the intended workflow ?
(Using Mac OS)

Could not connect to Playdate Simulator

Hey,
Every time I try to use "Playdate: Debug" via F5, I get a popup saying, "could not connect to Playdate Simulator"
Despite that game starts in the simulator, but it does not trigger any breakpoints.

I'm trying to run Lua game with:
vscode 1.74.2
PlaydateSDK 1.12.3

Cannot Attach to Simulator

I am unable to attach to the simulator, build and run are passing. launch and tasks Json files below. Am I missing something?

{
    "version": "0.2.0",
    "configurations": [
      {
        "type": "playdate",
        "request": "launch",
        "name": "Playdate: Debug",
        "preLaunchTask": "${defaultBuildTask}",
        "output": "Output",
        "source": "source"
      }
    ]
  }
{
    "version": "2.0.0",
    "tasks": [
      {
        "type": "pdc",
        "problemMatcher": ["$pdc-lua", "$pdc-external"],
        "label": "Playdate: Build"
      },
      {
        "type": "playdate-simulator",
        "problemMatcher": ["$pdc-external"],
        "label": "Playdate: Run",
      },
      {
        "label": "Playdate: Build and Run",
        "dependsOn": ["Playdate: Build", "Playdate: Run"],
        "dependsOrder": "sequence",
        "problemMatcher": [],
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }

Incorrect .pdx name used & can't deal with spaces

When there is a space in the name field in pdxinfo, the standard Playdate: Debug launch no longer works and the simulator doesn't even open. I see this in the logs:

Starting Playdate Simulator...
> "~/apps/PlaydateSDK-1.12.2/bin/PlaydateSimulator" ~/git/playdate-swap-machina/Swap Machina.pdx

(Note the lack of quotes around the path to the pdx).

Furthermore, changing the output field in launch.json had no effect either. It did not change the path to the pdx as run by PlaydateSimulator. The only effective solution I found was to rename the game in pdxinfo to have no space. (Consulted on Discord. This was due to having the "orta" playdate extension also installed and is unrelated.)

I use Linux, by the way.

Building with make

Is it possible to configure this extension to build with make rather than pdc to allow the development of games using custom C functions? The Nova Playdate plugin has a playdate.build-type argument that allows you to compile via make, but I can't see anything similar in your VS Code plugin.

I understand this is probably a huge feature ask, but VS Code is a lot nicer for Lua development than Nova in my opinion, so it would be fantastic if there was a way to still build and launch my game directly from Code now I've had to start adding some custom C functions for performance reasons.

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.