johnno1962 / InjectionApp

Issue Tracking Repo for Injection as an App
MIT License
111 stars 7 forks source link

Compiling wrong file #20

Closed plam4u closed 7 years ago

plam4u commented 7 years ago

Hi there,

I'm working on a file, but when I inject it compiles unrelated file.

Example: Editing ClassX but when injecting it asks me "Did you save file ClassY?"

I expect to Injection to re-compile ClassX which I currently work on. Note: I've tried to select the text in the ClassX file which was suggested somewhere.

plam4u commented 7 years ago

Update: I think that what you need to select is the file in the Project Navigation and not just select the text in the file you edit.

plam4u commented 7 years ago

I confirm that you should select the file in the Project Navigator. This is what works for me. It doesn't matter what text I select in the Code Editor.

~SOLUTION~: select the file in the Project Navigator

EDIT: Also, seems that if you have in your Xcode Assistant Editor opened, it's important that the selected file is opened in the Primary Editor and not in the Assistant Editor.

EDIT: The solution doesn't work. Now I cannot make it compile no matter what I do. It always compiles a file that I don't want. I would add a feature request to make it possible to compile a file that you select and not relate to the automatic file selection.

johnno1962 commented 7 years ago

Have you tried without Xcode Assistant Editor? I’ve not heard of this problem before.

plam4u commented 7 years ago

yes, I've tried without it.

What worked for me for this specific case was to restart both xcode and simulator. Probably restarting just one of the would do the trick but I wanted to be sure.

johnno1962 commented 7 years ago

Restarting Xcode is whats fixing it. Injection can only get a list of documents that have been edit from it’s Apple Script api and does some divining to work out which is he current document (has selection.) I had thought this was working but it seems it doesn’t when you are using the assistant editor.

johnno1962 commented 7 years ago

I’ve uploaded a new version which should fix this by selecting the most recently modified file if there is any doubt. Can you give it a try?

plam4u commented 7 years ago

hey, John, I've tried it and so far I don't see any problems! Thank you for the update!