Search code examples
javascriptxcode4syntax-highlighting

Xcode 4 doesn't save syntax highlighting for project files?! (And doesn't auto-recognize JS files?!)


You're kidding, right?

Not only is it bad enough that I have to select Editor > Syntax Coloring > Javascript for every JS file in my project, whenever I restart Xcode 4, all the Syntax Coloring preferences set up disappear for each file. Shouldn't this be saved in the project somewhere?

  1. Why don't .js files automatically get detected as javascript syntax?

  2. And why doesn't Xcode save this preference at the project level or at the very least, for the files on which you've selected it?

Please tell me there's a better way.


Solution

  • Syntax highlighting for JavaScript works fine for me in Xcode 4.3.2 (plus I haven't noticed any issues in earlier versions). Xcode is very temperamental - you should try deleting the derived data as jayboston suggests - I often have to do this and restart Xcode a number of times to have it work properly.

    If that doesn't solve it then there's a chance your xcodeproj file might be a little corrupted or at least hard for the system to understand. Try creating a new project file and then importing all your old contents into it (manually - don't copy from the old project file) to see if that fixes anything.