2

In Xcode 7, want to change the default syntax coloring (default is "None") for a given filetype (in this particular case, ".mod" file).

There is a plist file under /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsCore.framework/Versions/A/Resources/Standard\ file\ types.pbfilespec

in which we can control the default settings for each language. For example, under "c.c" (there is also "c.h", both of which inherit from "c") there is an array "Extensions" containing one element "c". Ideally now I'd like to simply add a second item to the array here "mod". However, this did not change the default syntax highlighting for ".mod" files to have the same coloring as ".c" files (".c" files are still colored as before).

Does anyone know how to add a new default coloring for a given filetype?

More info on the plist: Standard file types.pbfilespec uses definitions in Built-in file types.pbfilespec, which contains e.g. a file type with identifier "sourcecode", which is what most file extensions ".c" etc. are. The specific syntax coloring settings for each language are specified in Built-in languages.pblangspec.

smörkex
  • 336
  • 3
  • 18
  • I'm going down the same rabbit hole. Not working. Have you figured it out? – Steve Mar 02 '17 at 21:23
  • I never did, sorry - but still would like to, if it is ever figured out! – smörkex Mar 02 '17 at 22:00
  • I found a solution elsewhere. See my answer. Editing pbfilespec is a dead end. Wasted too much time on it till I decided to try the more complicated solution, and that works. Thanks, Apple... – Steve Mar 03 '17 at 23:55

1 Answers1

0

Follow the instructions in the below answer:

Adding syntax coloring to Xcode for unknown file extension such as ".tcl"

If you want to treat it as C source code, use public.c-source for the UTI.

Community
  • 1
  • 1
Steve
  • 571
  • 5
  • 10