sweetpad-dev / sweetpad

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

Proposal: auto run xcode gen when a file is created #7

Closed ceopaludetto closed 1 month ago

ceopaludetto commented 2 months ago

My current workflow is pretty god. But, it's kinda sad to rerun both xcode gen and xcode-build-server on every new file created, so it would be awesome if on every newly created file the extension automatically rerun xcode gen for us (to automatically insert the newly created file into the .xcodeproj stuff)

hyzyla commented 2 months ago

Hello 👋

Thanks for the feedback! When you are saying about xcode gen do you mean this tool https://github.com/yonaskolb/XcodeGen ? I'm thing of introducing automatic sync of files with groups, as I understand it will help Xcode project to see file as part of your project

ceopaludetto commented 2 months ago

Thank you for the quick support and the amazing job done in the extension

When you are saying about xcode gen do you mean this tool https://github.com/yonaskolb/XcodeGen?

Yes. As far as I know, the only way to include files created outside of Xcode into the project is by using solutions like XcodeGen and Tuist right? So every time I create a new file, I run XcodeGen and xcode-build-server again

I'm thing of introducing automatic sync of files with groups, as I understand it will help Xcode project to see file as part of your project

This would be awesome

hyzyla commented 2 months ago

Yeah, it definitely on my todo list.

First idea is to give option in settings that will start background logic that will monitor for new files in project and will sync groups and files on disk.

Another idea is give some tool for manage groups: add/remove new files to the group, create new group and so on. But I'm not sure how much people use groups that differs from file system structure on disk

hyzyla commented 2 months ago

@ceopaludetto, hello!

I've added a new VSCode command to generate an Xcode project using XcodeGen:

  1. Open the command palette "⌘ + P".
  2. Enter: > SweetPad: Generate Xcode project with XcodeGen

Currently, you have to run it manully, but I'm considering adding some logic to run it automatically when files change in the future. Also, I'm looking for ideas on how to improve XcodeGen integration with VSCode, so let me know if you have any.

⚠️ Additionally, I discovered that the author of xcode-build-server recently added experimental support for indexing new files without rebuilding whole project. You can see my comment on how to setup workflow link and provide some feeback if you have some problems with it.

Let me know, if it works for you 🤝

ceopaludetto commented 2 months ago

@ceopaludetto, hello!

I've added a new VSCode command to generate an Xcode project using XcodeGen:

  1. Open the command palette "⌘ + P".
  2. Enter: > SweetPad: Generate Xcode project with XcodeGen

Currently, you have to run it manully, but I'm considering adding some logic to run it automatically when files change in the future. Also, I'm looking for ideas on how to improve XcodeGen integration with VSCode, so let me know if you have any.

⚠️ Additionally, I discovered that the author of xcode-build-server recently added experimental support for indexing new files without rebuilding whole project. You can see my comment on how to setup workflow link and provide some feeback if you have some problems with it.

Let me know, if it works for you 🤝

Hello!

Amazing! the command will speed up the things here. But, I was thinking yesterday on some solutions without having to listen the file changes(this seems to be very difficult to implement reliably), so I've remember that almost every developer rebuild his projects to check changes. For now maybe an options to run xcodegen before xcodebuild everytime I hit the start button in the extension panel would be awesome, this combined with the xcode-build-server thing that you mentioned will almost be the same experience xcode users have right? What you think?

Thank you for the support

hyzyla commented 2 months ago

@ceopaludetto I've published a new version of the extension (0.1.11) with the new config sweetpad.xcodegen.autogenerate:

Watch for new .swift files and regenerate the project using XcodeGen. Restart VSCode to apply the settings.

To use it:

  1. Update the extension.
  2. Add "sweetpad.xcodegen.autogenerate": true to your .vscode/settings.json VS Code config file.
  3. Restart VSCode.

The extension will monitor for new **/*.swift files and changes in project.yaml and will regenerate the Xcode project if there are any changes.