0
votes

In notepad++, the tcl command arguments get highlighted. Like this:

puts [my_tcl_command -arg1 foo -arg2 bar]

How can I change the syntax highlighting definition in Sublime Text 2. I guess it's somewhere in this file "Sublime Text 2\Packages\TCL\Tcl.tmLanguage".

1

1 Answers

1
votes

Syntax highlighting in Sublime Text is controlled by two files - the .tmLanguage file, which you mentioned, and your theme's .tmTheme file. Scopes are assigned to your code by interpreting regular expressions contained in the .tmLanguage file. For example, puts is assigned the scopes source.tcl keyword.other.tcl You can determine this by putting your cursor in a certain spot, then hitting CtrlAltShift-P - the scope(s) will appear in the bottom bar. Alternatively, I highly recommend using the ScopeHunter plugin.

So, now that we have the scope, it's up to the tmTheme file to assign the syntax highlighting. Unless you've installed a plugin theme, these files live in the Packages/Color Schemes - Default directory. It's in XML format, and you can search for the scope that's assigned to your -arg1 and -arg2 arguments and change the colors - they're in hex RGB web format.

EDIT

I just re-read your question, and realized that you want to assign a new scope to highlight the arguments. For that, you'll need to edit the .tmLanguage file and add a new regex to highlight them, assign a scope, then either alter your .tmTheme to add the new scope, or just assign one that's already highlighted. I don't know that much about how Notepad++ assigns its syntax highlighting rules, so you may be able to find one already written. Taking a look at other .tmLanguage files can be very instructive, as well. I recommend the Python one, even though it's not terribly well organized, because there are a large number of scopes, and it's fairly easy to see what's being done.