Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add support for target_for_file_atPath ? #199

Open
iMostfa opened this issue Oct 13, 2024 · 6 comments
Open

Is it possible to add support for target_for_file_atPath ? #199

iMostfa opened this issue Oct 13, 2024 · 6 comments

Comments

@iMostfa
Copy link

iMostfa commented Oct 13, 2024

Hello,

I've been using nvim for with Xcodebuild.nvim and i'm really enjoying it, Thanks to your great work,

nonetheless, i have some small problems, mostly related to the fact that i'm working on a quite complex project structure.

so i wanted to ask if it's possible (technically at least) to be able to provide the target from the config for a new file that was just created ?

something similar to should_update_project but it returns the String of the target.

more context:

my project Structure Can be -simplified- to be like this:

AppName.xcworkspace
- MonolithModule.xcodeproj // (links all child modules, when run, it opens the app in simulator)
- Pods.xcodeproj (Contains all child modules, something like, LoginScreen, CancelScreen` 

by default i have XcodeBuildServer pointing to MonolithModule because this's how i can build and run the app.

when i add a file to one of the modules inside Pods, targets inside Pods isn't detected, (Which is expected behaviour given that i'm poitning to MonolithModule)

currently i need to switch my xcodeBuildServer config to point to the modules, to be able to add files, which works, but kinda exhausting because i always need to run the app.

currently i defer adding new files to the end of my workflow, so i keep adding my logic into existing files, then at the end i move all of them to new files after pointing to the new module.

another alternative to this issue would be having the option of providing a custom run scheme/project.

so i will get my XcodeBuildServer pointing to Pods but when i run the app, it will run the main project and main target

Thanks a lot for you, i want to know if it's possible, because if you think that it's worth it, i might try to support it and open a PR.

@wojciech-kulik
Copy link
Owner

Hmm, it looks like #188 might be what you are looking for :).

If you set:

 integrations = {
    nvim_tree = {
      find_xcodeproj = true, -- instead of using configured xcodeproj search for xcodeproj closest to targeted file
    },
},

The closest xcodeproj will be used instead of the one configured for the project. Let me know if it resolves your issue.

@iMostfa
Copy link
Author

iMostfa commented Oct 15, 2024

@wojciech-kulik i remember that i tried this option, but it didn't work for me, i will try it again today and inform you.

@iMostfa
Copy link
Author

iMostfa commented Oct 15, 2024

@wojciech-kulik didn't help me, still showing the targets from the main project :/

@wojciech-kulik
Copy link
Owner

How do you add a file?

@Almaz5200
Copy link
Contributor

I think #188 doesn't work because it doesn't try all of the .xcodeproj files in a directory, just the first one it finds, probably alphabetically. So if MonolithModule and Pods are in the same folder it likely tries MonolithModule, fails, and moves on.

Or maybe it even quits right away as soon as it gets to cwd

@wojciech-kulik
Copy link
Owner

Yeah, it depends on the structure of the project. I assumed that each xcodeproj has its own folder, that way the search should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants