I\'d like to get Xcode 4 to recognize a custom file extension (e.g. *.lx) as Objective-C for syntax highlighting and indentation purposes. How do I get the tool to automatically
Xcode has a "Type" field in the "Attributes Inspector" (leftmost tab in "Utilities" right sidebar) for files in your project:
As you can see above, I set our project's Fastfile
to be recognized as a Ruby Script—which it is, despite lacking the expected .rb
extension. Yielding the expected syntax highlighting (with my custom color scheme):
Note: this only works if the file is added to your project within a group (not inside a folder reference):
This might not be ideal, but Xcode can't persist attributes of files which aren't explicitly tracked in the project file. Folders, by design, don't have entries for their contents in the Xcode project, since it's meant to be dynamic.