sweetpad icon indicating copy to clipboard operation
sweetpad copied to clipboard

Any plans to support running simulators via Sweetpad launch.json?

Open N-Joy-Shadow opened this issue 1 year ago β€’ 5 comments

Opening Sweetpad and running the simulator or running it with commands is too much work. Also, the process of deciding what to do with an already open simulator makes the mouse move. I would like to see the existing functionality of pressing f5 to launch with a preset value in launch.json.

N-Joy-Shadow avatar Jul 16 '24 06:07 N-Joy-Shadow

Could you describe your workflow in more details? I'm trying to understand how better to implement that

hyzyla avatar Jul 21 '24 13:07 hyzyla

image
Sorry for the delay in replying. I've been busy lately and didn't get back to you
I want to skip the process and restart as shown in the picture above

image

I don't know much about vscode extension, but I think you could add restart and pause buttons similar to the photo above, or use the debug and run function in vscode itself to run the simulator.

N-Joy-Shadow avatar Aug 01 '24 13:08 N-Joy-Shadow

Previous weekend I updated the way how debugger works. So basically it will attach to running app as in previous versions, but it also launches app on simulator using preLaunchTask. I can't say that it works ideally, but at least it should simplify first setup.

I think I'll try to find out how to make stop and restart commands work after launching debugger. Maybe this or next month. Because currently I don't have any idea how to do it

  1. https://github.com/sweetpad-dev/sweetpad/blob/main/docs/wiki/debug.md

hyzyla avatar Aug 01 '24 20:08 hyzyla

If I have an existing iOS app running, will the debugger connect to it? Do I need to press the stop or disconnect button to restart it?

N-Joy-Shadow avatar Aug 11 '24 05:08 N-Joy-Shadow

If I have an existing iOS app running, will the debugger connect to it?

@N-Joy-Shadow, I've just checked and found that if you need to connect to an already running application, you can use this config in your launch.json without building applicaiton ("preLaunchTask": "sweetpad: launch"):

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "sweetpad-lldb",
      "request": "launch",
      "name": "Attach to iOS app (SweetPad)"
    }
  ]
}

In that case, the extension tries to find the path to the last launched app build.lastLaunchedAppPath in the extension state and uses that path as a parameter for the CodeLLDB extension. So, as you may guess, to use that option, you must launch your application using the extension: either via the sidebar or with a command like 'Sweetpad: Build & Run (Launch).'


Do I need to press the stop or disconnect button to restart it?

After trying different options, it seems that currently, it doesn't work so well. Here’s a breakdown of what happens if you press those buttons on the panel:

  • If you have "preLaunchTask": "sweetpad: launch" in your launch.json: - πŸ”„ β€” The app will be built and launched again, but only once 🫀. - πŸ”Œ β€” The debugger will just disconnect, and the next time you try to start a debugging session, it will just connect to the currently running app. - πŸŸ₯ β€” This button will stop the debugger, stop the app, and stop the preLaunchTask task.
  • If you don't have "preLaunchTask": "sweetpad: launch" in your launch.json: - πŸ”„ β€” The app will simply be closed 🫀. - πŸ”Œ β€” The debugger will just disconnect, and the next time you try to start a debugging session, it will just connect to the currently running app. - πŸŸ₯ β€” This button will stop the debugger, stop the app, and stop the preLaunchTask task.

For me everything work quite broken, except πŸ”Œ button, which works as expected. Do you have any ideas how to improve debugging? I can't promise I'll be able to implement this, but I'll at least give it a try

hyzyla avatar Aug 11 '24 09:08 hyzyla