Xcode 10.1 Autocomplete/code highlighting not working

Autocomplete/code highlighting doesn't work for about half the files in my project. I've seen this on occasion in other versions of Xcode but this time none of the usual fixes (cleaning the project, empting derived data, quiting Xcode, etc.) seem to work. Has anyone had the same issue and managed to fix it?

Replies

I don't know if this will be relevant for you.


I had some similar troubles when I duplicated a project (in Finder, to work on a new copy). Then, I opened file using "recently opened" button in XCode.

And weird things happened (impossible to connect an IBOutlet, modifications not taken into account…), because it was not using the right file (I could see it at the top of the file pane, where you usually have a full path fo the file as folder > subfolder > myFile, I had just > myFile

Clearing derived data, restarting, … rebooting Mac did not solve anything

To solve, I selected the file from the project file browser in XCode (very left pane) and everything worked OK.

Me too

I have the same Problemes here.
Sometimes Autocompletion and code highligthing don't work.

Sometimes I have no code highligthing and sometimes only half of the code is highligthed ? 😮
When I have these problems sometimes breakpoints will be ignored.
Very strange things are goind on and I don't no why.



I tried severaI havel differnent things:
- Clear derived data
- Restart Mac

- Restart XCode

- Rebuild

Nothing really works 😟

To solve, I selected the file from the project file browser in XCode (very left pane) and everything worked OK.

This is insane, but it worked for me too. Thank you.

@sur-la-mer
That's effectively pretty surprising.

But I think the reason is that the file that shows is not the one that is connected to the IB file. Some mess up in Xcode (getting confused by its "recent" list ?).
It happened also that changes made to the file were saved… to another copy (with the same name but different project).
Selecting on the left in the project file browser forces to select the right file.
Then it works.

But anyway, that's extremely disturbing.