Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Sublime Text, the default is for .m files use the Objective-C syntax, not the Matlab syntax (which uses the file type .matlab) - with an explanatory note in Matlab\Matlab.tmLanguage:

<key>fileTypes</key>
<array>
    <!-- Actually, it's generally .m, but that's taken by Objective-C. It needs an entry to show up in the syntax list. -->
    <string>matlab</string>
</array>

However, in the Objective-C\Objective-C.tmLanguage file, we see:

<key>fileTypes</key>
<array>
    <string>m</string>
    <string>h</string>
 </array>

but, in the C/C.tmLanguage file, there is:

<key>fileTypes</key>
<array>
    <string>c</string>
    <string>h</string>
</array>

So, why can .h files be associated with 2 different syntax classes, but .m not?

share|improve this question
    
It looks like the alphabetically first language wins, and since there are probably more Objective-C than MATLAB users using ST for their respective field (at least among the Sublime Text developers), that would inconvenience the former group? Also, C and Objective-C syntax is rather similar, so using one syntax definition for a file in the other language will not be a big deal. .m is also pretty much set in stone for Objective-C implementation files -- it might be more of a convention in MATLAB? FWIW You can just change the MATLAB package and enjoy the default syntax when opening .m files. –  Daniel Beck May 3 '13 at 15:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.