Differentiate syntax coloration of Python Strings vs. Docstrings in Textmate?
Love TextMate, love Python, blah, blah, blah..
But.. i hate that "Docstrings", aka multiline-comments / Sphinx's lovechild - are colored syntactically - in the same manner as normal "Strings", in my aforementioned editor of cho开发者_StackOverflow中文版ice. Here is an example of the two types in their overly matchy-matchy outfits...
Can this slight inconvenience be regexed-away - so as to differentiate the two more easily, visually?
If you look at lines 560-1064 of the language part of the Python bundle, you'll find the definitions for strings. Simply, you'd find the patterns for the triple-quote strings and add another component to the capture names. Then all you need to do is add that capture name to your current style and then triple-quote strings should be colored differently.
Add this to code to your theme file to make doc strings appear different from regular strings.
{ name = 'Pyton: Docstring';
scope = 'string.quoted.double.block.python';
settings = {
foreground = '#A7C3CC’; //change color to your preference
fontstyle = '';
};
},
If you need the XML version this is it:
<dict>
<key>name</key>
<string>Python: docstring</string>
<key>scope</key>
<string>string.quoted.double.block.python</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string/>
<key>foreground</key>
<!-- change color to your preference -->
<string>#A7C3CC</string>
</dict>
</dict>
精彩评论