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 do this?
Xcode->preferences and then select General tab you will see File Extension option. With this option, you can hide and show files extensions.
Objective C files In objective C, files normally use the extension . h for interface files and the extension . m for implementation files.
Developer project file created by Xcode, a software development IDE used for creating Mac OS X applications; much less commonly used than . XCODEPROJ, which is the default Xcode project file extension.
Xcode determines how to represent a file in its user interface based on the file's Uniform Type Identifier. As far as I know it's not possible to add additional file extension tags to an existing UTI, but you can declare a new UTI that conforms to the type you want to map to. The system will then associate the specified file extension(s) with your new UTI and through conformance Xcode and every other UTI-aware application will recognize the files as source code of the mapped type.
You may want to give some thought to where to declare to the new UTI. For example, if files of this type are being created by a tool the bundle for that tool would be the most appropriate location. In the absence of a better alternative you can create a stub application bundle and declare the new UTI there:
com.yourdomain.objective-c-source
.public.objective-c-source
. You can find this by browsing the list of system-declared UTIs or those exported in Xcode's Info.plist.Xcode should now use appropriate syntax highlighting for files with the specified extension(s).
If this doesn't work, check the Info.plist of the built application to ensure that all of the expected information is there without any trailing whitespace. You can also check that the UTI has been registered using lsregister
:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump
Search the output for your UTI's identifier and verify that it is present and active.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With