sweetpad-dev / sweetpad

Develop Swift/iOS projects using VSCode
https://marketplace.visualstudio.com/items?itemName=sweetpad.sweetpad
MIT License
619 stars 20 forks source link

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

Open N-Joy-Shadow opened 4 months ago

N-Joy-Shadow commented 4 months ago

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.

hyzyla commented 4 months ago

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

N-Joy-Shadow commented 4 months ago

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.

hyzyla commented 3 months ago

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
N-Joy-Shadow commented 3 months ago

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?

hyzyla commented 3 months ago

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:

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