XCode Syntax Coloring Broken
Asked Answered
W

2

6

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.

Weider answered 8/6, 2010 at 5:26 Comment(0)
W
7

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.

Weider answered 8/6, 2010 at 6:29 Comment(5)
PS.) I posted a bug report with Apple and received the following response: Hello Steven, This is a follow up to Bug ID# 8069971. After further investigation it has been determined that this is a known issue, which is currently being investigated by engineering. This issue has been filed in our bug database under the original Bug ID# 4824854. The original bug number being used to track this duplicate issue can be found in the State column, in this format: Duplicate/OrigBug#.Weider
I think I found a workaround. See my answer here: #2138547Forename
After a month of banging my head over this issue, with none of the fixes online actually working, I finally fixed this in my project the same way you did, by fixing an incorrectly done #ifdef. I had never noticed the error before and GCC didn't flag it as a warning. Just switched to LLVM today, which did flag a warning, and as soon as I fixed it, deleted derived project data, and reindexed it's working great now!Reseta
@einsteinx2 - I know, it's terrible, isn't it!?Weider
I'm literally ecstatic now that I have highlighting and code complete back. It was such a PITA to go months without it. I made do, but everything was more time consuming, and code was harder for my brain to parse. SOOOO HAPPY RIGHT NOW!! :)Reseta
C
12

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.

Coridon answered 13/3, 2012 at 12:28 Comment(2)
Thanks for the input, but I had answered my own question two years ago. It was a problem with code inside a precompiler directive.Weider
Sure, I saw that. I was just giving another indication for people that might be experiencing the same problem as you, but not for the same reasons (it was my case).Coridon
W
7

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.

Weider answered 8/6, 2010 at 6:29 Comment(5)
PS.) I posted a bug report with Apple and received the following response: Hello Steven, This is a follow up to Bug ID# 8069971. After further investigation it has been determined that this is a known issue, which is currently being investigated by engineering. This issue has been filed in our bug database under the original Bug ID# 4824854. The original bug number being used to track this duplicate issue can be found in the State column, in this format: Duplicate/OrigBug#.Weider
I think I found a workaround. See my answer here: #2138547Forename
After a month of banging my head over this issue, with none of the fixes online actually working, I finally fixed this in my project the same way you did, by fixing an incorrectly done #ifdef. I had never noticed the error before and GCC didn't flag it as a warning. Just switched to LLVM today, which did flag a warning, and as soon as I fixed it, deleted derived project data, and reindexed it's working great now!Reseta
@einsteinx2 - I know, it's terrible, isn't it!?Weider
I'm literally ecstatic now that I have highlighting and code complete back. It was such a PITA to go months without it. I made do, but everything was more time consuming, and code was harder for my brain to parse. SOOOO HAPPY RIGHT NOW!! :)Reseta

© 2022 - 2024 — McMap. All rights reserved.