I’m creating a file template for a file with an extension that Xcode doesn’t recognise. Xcode doesn’t apply syntax highlighting to the file but I’d like it to. I would like Xcode to recognise the file as com.netscape.javascript-source
even though the file extension isn’t .js
(the file is actually jsonnet). I tried setting the AllowedTypes
property of the TemplateInfo.plist
to the UTI of JavaScript but that had no effect.
Alternatively, is it possible to define a new file extension for an existing UTI?
This question was answered on similar question.
It looks the only possible solution is to create a Cocoa Project that declares a new UTI.
Check those:
How to make XCode recognize a custom file extension as Objective-C for syntax highlighting?
Adding syntax coloring to Xcode for unknown file extension such as ".tcl"