Sublime Forum

Add tags to syntax

#1

Hi.
I have no idea what I am about to do, so need some help.
When I write a string (or tag is it?) like @return the color of that string is syntaxed with a different color.

Where can I add more of those strings/tags to be syntaxed?

Thanks

0 Likes

#2

A file named **yourlanguage.tmLanguage **provides scope-names for the various language elements, keywords, and structures of your chosen language. Your chosen theme file (.tmTheme) may then use these scope-names to provide specific colours.

It requires a bit of study to modify the .tmLanguage file - create a copy first, of course! This is an XML file, and many prefer to convert it to a pList firstly as they find this easier to work with. There is a plugin available on Package Control to convert XML to pList (and back again). The TextMate manual provides a reasonable introduction to the language grammar. However, a knowledge of RegEx is also necessary.

The easiest approach would be to search PackageControl, or elsewhere, for a syntax file or Package for your chosen language.

If you’re very lucky you might find the tmLanguage contains something like:

(robert|dave|pete)

in which case you could slip in:

(robert|dave|pete|mary)
0 Likes

#3

Thank you so very much :smile:

I just opened my php language file, searched for “param” and found a list of words like you showed me in your example that all get the same color with a @ in front. So @param, @return etc was all in that list. I just added retval og file. Now it’s easier to document my code with doxygen.

Next step would be to have a plugin that just fills out the doc-block for me with @param for each argument in the method. Netbeans does this for me, but havent found any plugin in sublime to do that.

0 Likes