Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode Syntax Coloring Broken

XCode frequently seems to lose it's mind, and doesn't color code system classes or provide correct "code sense" suggestions. This is endlessly frustrating. The question has been asked on at least three other occasions:

Problems with Xcode Syntax Highlighting

xcode code sense color/completion not working

Xcode: code loses syntax coloring

I have switched by project version to/from 3.1-compatiable and 3.2-compatiable, completely restarting XCode before and after each change with no effect.

I have rebuilt the code sense indexes and completely restarted XCode with no change.

I have built my project to make sure there are no errors and restarted.

I have copied my files (sans .svn files) to a different location - same problem.

I've already completely disabled the argument "placeholders" because they screw up my documents when i type too fast... all I'm asking for is for the "esc" key to display the correct list of properties and methods.

like image 843
Steve Avatar asked Jun 08 '10 05:06

Steve


2 Answers

You should clean your project's derived data. They are likely corrupted.

Go to Organizer > Projects > Your_Project > Derived Data > Delete

Xcode will reindex your project and you should be back to normal.

like image 165
KPM Avatar answered Nov 05 '22 05:11

KPM


For anyone interested; my app has some precompile directives:

#if ...

Turns out there was an error in one of these sections.

I'm assuming my app built fine because these sections were stripped out before they ever got to the compiler... but CodeSense doesn't care about these (it still wants to color code everything inside these) - so CodeSense would puke all over the place because of the error, even though I didn't find it when I tried to build the app.

Once I fixed the error within that block of code, my coloring returned.

Would be nice if XCode just greyed out those sections instead of dying.

like image 31
Steve Avatar answered Nov 05 '22 05:11

Steve