[TxMt] Re: Best approach to add new Scoping rules to grammar

Alexander Ross alex.j.ross at gmail.com
Mon Feb 12 06:42:23 UTC 2007


Yes, ReST is pretty ugly.  Markdown would have been a better choice.

- Alex

On Feb 11, 2007, at 9:54 PM, Jacob Rus wrote:

> Steve Lianoglou <lists at ...> writes:
>> I was wondering what the best approach to enable this functionality
>> would be:
>>
>> I use reStructuredText as the format of my doc strings in my python
>> files, and so I'd like to enable the reStructuredText snippets,
>> macros, etc. to fire in my python """ ... """ strings.
>>
>> The scope of these strings in the Python files are:
>>      string.quoted.double.block.python
>>
>> Should I just add this scope to all of the commands in the
>> reStructuredText bundle, so all of the scopes for those commands
>> would be changed to:
>>      text.restructuredtext, string.quoted.double.block.python
>>
>> Or should I change the Python grammar to somehow set those two scopes
>> for the """ ... """ string matching pattern (I'm not sure if you can
>> do that, though).
>
> At the moment, the best way is probably to just edit the python  
> grammar, adding
> the text.restructuredtext scope to the strings.  Then you'll also  
> get niceties
> like syntax highlighting for reST inside your python strings, etc.
>
> This is far from ideal though, and Allan's scope injection system  
> for textmate 2
> should provide a much more elegant method.
>
> * * *
>
> Incidentally, are any other python users bothered by the decision  
> to use reST as
> the de facto format for docstrings?  reST really clashes with  
> python's clean
> aesthetic for me.
>
> -Jacob
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list