Reputation: 4675
So I've had countless issues with the Xcode syntax coloring in the past. I've been able to fix them through various trials and each solution is different from the next. This time, I can trace the problem to a specific event so I am wondering if others have had this problem and know of a solution.
My syntax coloring was just fine until I did a 'git pull' from the terminal. After the pull, only one method was completely broken while the rest of my code was partially colored correctly. By partial I mean objects and methods were being colored the same color (which they shouldn't) but it was better than nothing, right? Well, to fix this I decided to close the project and delete my derived data then reopen the project. After reopening, the coloring is completely broken.
Has anyone had this problem after pulling from git?
Upvotes: 2
Views: 285
Reputation: 4675
I fixed it! What ended up working for me was the following:
Deleted the line #import <opencv/cv.h>
in .pch file because it was being imported on every class that was using it, therefore this import was redundant.
Deleted the line #import <Foundation/Foundation.h>
from one of my .h files. This line was already contained in my .pch file so this extra import was redundant.
Added the line #import <UIKit/UIKit.h>
to the top of your files "ApplicationDelegate.h" and "main.mm". I previously only had it in my "ViewController.h" and .pch files.
Saved files and closed Xcode.
In Finder, went to Users/~/Library/Developer/Xcode/DerivedData/ and deleted the folder associated with my project.
Reopened Xcode and the project and waited for it to "reindex".
Success!
It seems redundant #imports between your .pch file and other header files in your project can break the syntax coloring. A good way to see if this might be the problem is just delete the contents of your .pch file temporarily and see if that alone fixes the issue. If so, you may have some redundant #imports.
Upvotes: 1
Reputation: 3835
I lose syntax coloring all the time in xcode (there are some serious bugs there Apple needs to fix). I can always fix them by quitting xcode and restarting. I also followed a tip I found on the Internet that said that using recursive header search paths (/**) can also cause it to break. I removed all them from my project and it fixed it for a while.
Upvotes: 0
Reputation: 46334
I would guess you pulled in some files that changed settings.
Where did you do the pull from? Look at any new files that were introduced, or config files that were changed.
Upvotes: 1