nisargjhaveri / vscode-ios-debug

iOS debugging in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=nisargjhaveri.ios-debug
86 stars 10 forks source link

Open the Simulator app before launching app. #5

Closed bzarco closed 2 years ago

bzarco commented 2 years ago

This is something I have on my scripts for non-debug runs. Sometimes I start debugging without the Simulator app being open, and it is nice for it to launch automatically (specially because attaching works without it being open, so it can be a bit confusing at first). Feel free to close if you don't think it is useful.

nisargjhaveri commented 2 years ago

This is useful, especially on first boot as it is confusing to not find the simulator anywhere and having to manually open Simulator app.

Though, I'm not super exited about it gaining focus on every launch, since the launch and attach can take arbitrary amount of time after this (As of now we do take more time than Xcode for attaching in general.)

Thoughts?

bzarco commented 2 years ago

I moved it to postRunCommands on lldb, which afaik is the most we can delay it (and opens it for attach requests too, which I think is desired). Unfortunately it still takes a while to attach... Testing the Xcode behavior, it does launch the Simulator stealing focus on every run, which means this behavior is probably expected by most users. Although the time between Simulator stealing focus and the debugger being attached is negligible in Xcode, and it opens the Simulator at boot time without stealing focus until it launches...

Happy to make any more changes, or we could use open -a Simulator -g ..., which won't focus it, but in general I would expect bringing the Simulator to the foreground is the desired behavior. Whatever you prefer though.

nisargjhaveri commented 2 years ago

If I understand correctly postRunCommands run after the app is attached, no? In any case, you're right. I guess we can get the behavior closer to what Xcode does.

I had tried to get simulator focus on continue a long time back, but didn't spend much time there. I've created #7 with that. It also launches Simulator without focus to give early feedback about simulator booting. Have a look and let me know if you can spot any pitfalls with that approach?

Sorry for hijacking your solution. I had that approach in mind for some time for focusing simulator on continue and wanted to try out!

bzarco commented 2 years ago

No problem! Your solution looks great, thanks! Closing this.