Whitebrim / VSCode-PlaydateTemplate

This template will help you with autocompletion and running your code in simulator. Windows & Linux.
202 stars 25 forks source link

Confusion with type in `launch.json` #1

Closed bombsimon closed 2 years ago

bombsimon commented 2 years ago

Thanks for this template, really helpful to get up and running!

Now that Windows is supported, I saw an issue in the vscode-playdate plugin repository from a user using both this template and installed the vscode-playdate plugin. Since the plugin registers the debug type as playdate, every user that uses this template and the plugin will launch the simulator twice (or in this case get an error since no output is configured).

Since you have a bunch of tasks configured, including running scripts to shut down running instances, I think they might be worth keeping. If so, just using a different type than playdate would avoid confusion and issues. As far as I know it will still run all the preLaunchTask even if the type is unknown so something like playdate-template should work.

Another alternative could be to just add Orta.playdate in extensions.json but that won't play nice with your tasks so they would become obsolete.

Whitebrim commented 2 years ago

Is it what you want? https://github.com/Whitebrim/VSCode-PlaydateTemplate/pull/3/files

bombsimon commented 2 years ago

If it still works for you that would be great! I won't be able to test this on a Windows machine until later tonight if you want me to confirm as well but! Thanks!

Whitebrim commented 2 years ago

I won't be able to test this on a Windows machine until later tonight if you want me to confirm as well but! Thanks!

Same for me...

bombsimon commented 2 years ago

Tried this now and apparently I was wrong, it's not possible to use a type that does not exist. Using this it launches the simulator but also get a popup saying Configure debug type 'playdate-template' is not supported. I tried to set it to node instead which is built in but that launches a node debugger that does nothing and needs manual stopping. On the other hand, uninstalling the playdate plugin and keeping it as it is now yields the same error but for playdate since it's no longer installed so maybe node isn't the worst.

One thing I thought of was that your template has a PowerShell script and assumes the user is on Windows so maybe it's not a bad idea to suggest and assume users install the PowerShell Plugin. If that's installed you can set the type to "PowerShell" and just call something that immediately terminates to exit out of the debugger but keep the simulator running (since it's launched through the task). I'm thinking something like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "PowerShell",
            "request": "launch",
            "script": "Write-Host Simulator Started",
            "name": "Build and Run (Simulator)",
            "preLaunchTask": "Build and Run (Simulator)"
        }
    ]
}
Whitebrim commented 2 years ago

@bombsimon Seems like without launch.json this template still is working and building project. https://github.com/Whitebrim/VSCode-PlaydateTemplate/commit/7c1f5a5841ede427374c451a12f2559be637e91f

bombsimon commented 2 years ago

Nice, thanks! Didn't know if you were OK not using the debugger but this is for sure the easiest way, just running the build task instead of the debugger should work fine!

Thanks for looking into this and helping sorting out the confusion! 💯