[TxMt] XCode 3.0 Ribbon Scope Highlighter

Gerd Knops gerti-textmate at bitart.com
Sat Aug 12 17:34:51 UTC 2006


On Aug 10, 2006, at 4:27 PM, thomas Aylott wrote:

> On Aug 10, 2006, at 8:08 AM, Luc Heinrich wrote:

>> Now, have you guys seen the XCode 3.0 screenshot showing the new  
>> "ribbon scope highlighter" ?
>> <http://www.apple.com/macosx/leopard/xcode.html>
>>
> Hows this for starters?
> http://flickr.com/photos/thomas_aylott/211990629/
>
Am I the only one who thinks that this is a sledgehammer approach to  
highlighting structure, and that it will interfere with syntax  
highlighting (I make occasional use of background colors)?

Some time ago a different approach to the same goal was discussed  
that involved highlighting leading tabs. It is relatively easy to add  
to all languages, Perl already has it:

	http://gerd.knops.org/tabHighlightExample.png

The only downside at this point is that for soft tabs the tab size is  
hardcoded, but I guess Allan could add something to fix that.

In most languages all that is needed is to include this into the  
syntax (replacing the 4 in ' {4}' with the default tab width for the  
language):

	{	name = 'meta.leading-tabs';
		begin = '^(?=(\t| {4}))';
		end = '(?=[^\t\s])';
		patterns = (
			{	match = '(\t| {4})(\t| {4})?';
				captures =
				{	1 = { name = 'meta.odd-tab'; };
					2 = { name = 'meta.even-tab'; };
				};
			}
		);
	},

Gerd




More information about the textmate mailing list