MATLAB Community

MATLAB, community & more

Editor syntax colors for non-M file types

I recently had a customer ask me how to make his mex files have correct syntax highlighting. He had a file type that was not specified in our default preferences. This is very easy to fix using preferences.

Here is an example. I have to edit info.xml files a lot because one of the things that I work on is the start button. But when I edit an xml file there is no syntax highlighting.

If the editor hightlights the file as html, it does a pretty good job of syntax highlighting. To make xml files syntax highlight as an html file, go to the Editor Language preference panel (File->Preferences->Editor->Language). Select “HTML” from the Language combobox.

This will open the html highlighting panel. Near the bottom of this panel is a File Extensions list that shows which files will be highlighted using this set of colors.

Click on the “Add” button and type “xml” into the dialog.

Hit OK to exit the dialog and OK to exit the preference panel.

Close the file and re-open it to see the changes.

From this point forward, all xml files will be colored as html files. You can associate any file type with M, C/C++, Java, or HTML highlighting sets.

And because I predict that you will ask, we are considering linking xml files to the html color set by default in a future release.

|
  • print
  • send email

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.