[TxMt] Re: Python bundle syntax highlighting bug

Fabry Nicholas F. nick at superb-sublime.com
Tue Aug 14 12:26:13 UTC 2007


On Aug 14, 2007, at 08:00, textmate-request at lists.macromates.com wrote:

>
> From: Steve Lianoglou <lists at arachnedesign.net>
> Date: August 13, 2007 14:03:56 EDT
> To: TextMate users <textmate at lists.macromates.com>
> Subject: Re: [TxMt] Re: Python bundle syntax highlighting bug
> Reply-To: TextMate users <textmate at lists.macromates.com>
>
>
>>>> I think you are probably right.  Does anyone else have an  
>>>> opinion on this?
>>>
>>> I agree this doesn't seem right, and can produce some confusing  
>>> results. On the other hand, it's very nice to have regex  
>>> highlighting.
>>
>> I prefer to trade-off false-positives for the nicety of regex  
>> highlighting.
>>
>>> Wouldn't it be possible to have the first string located within a  
>>> re.XXXXX('') pattern be highlighted as regex? Am I wrong, or are  
>>> those the only places where regex appear?
>>
>> s = r"...."
>> pattern = re.compile(s)
>>
>> is always, possible, if contrived. I think re.XXXXX is an  
>> interesting suggestion though.
>
> I'm in the same boat with Jay.
>
> I think it's kind of nice to have special highlighting for regex's.  
> I'd settle for it only being switched on when we have re.* 
> (r"regex" ... ) if the "always a regex w/ r" " really isn't  
> suitable for others.
>
> -steve
>
>
>
>
> From: "Alexander Ross" <alex.j.ross at gmail.com>
> Date: August 13, 2007 14:35:16 EDT
> To: "TextMate users" <textmate at lists.macromates.com>
> Subject: Re: [TxMt] Re: Python bundle syntax highlighting bug
> Reply-To: TextMate users <textmate at lists.macromates.com>
>
>
> I agree that it's very nice to have highlighted re's if possible.
>
> What if we did something like matching r"(?#) … " as a regular
> expression string?    The would give us something explicit to match,
> but it would also mean you'd have to add it to any of your preexisting
> re's.

That sounds like a very good idea.  It would be pretty easy to find  
regexes and sub in a '(?#)' comment marker (I had to look up what  
that one was!) so one would have regex syntax highlighting in  
existing code, while keeping the 'raw strings are just raw strings'  
folks happy.  For those who complain that r'(?# might just be the  
beginning of some particular, non-regex raw string, well.... too  
bad!  ;)

On a side note, it may be nice to keep a documented list of such  
'extra' features (above and beyond the straight language definition)  
in the Python bundle somewhere; for instance, the appearance of  
folding markers when a triple quote is followed by text, followed by  
a <return>, followed by another triple quote.  This regex  
highlighting feature would also qualify - otherwise, it would not be  
known to a new Python + TextMate user unless they stumbled across it  
by accident or investigated the grammar in detail...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070814/6a0df715/attachment.html>


More information about the textmate mailing list