[TxMt] Re: Customizing Syntax-Highlighting

Allan Odgaard mailinglist at textmate.org
Tue Apr 8 09:58:55 UTC 2014


On 8 Apr 2014, at 13:37, Ingo Lantschner wrote:

>> To make toggling quotes work, add proper scope to the string part, 
>> e.g.: […]
> hmh, the code above did not parse. I changed it to this one […]

That lost the changes I made to the match pattern (to collect the 
captures). Should have been:

	{	patterns = (
			{	name = 'comment.line.debug.perl';
				match = '\bi ((''.*'')|(".*")|(q{.*})|(qq{.*}));';
				captures = {
					2 = { name = 'string.quoted.single'; };
					3 = { name = 'string.quoted.double'; };
					4 = { name = 'string.quoted.other.q.perl'; };
					5 = { name = 'string.quoted.other.qq.perl'; };
				};
			}
		);
	}

> But it still has no effect on the toggling of quotes.

The above should use the proper syntax.

> […] How could I create a new "target", completely unrelated to
> comments. The present solution, to treat lines starting with `i` as 
> comments is
> more a workaround. In fact these lines are valid and executed Perl 
> code. What I
> really would like to see, is that they are **presented** (but not 
> treated) like
> comments.

In your injected rule, change ‘comment.line.debug.perl’ to e.g. 
‘meta.statement.debug.perl’.

After this, go to Themes → Themes → «the theme you are using» and 
locate the rule that styles comments.

Duplicate it and change the name/scope seletor, e.g. make it:

	{	name = 'Debug Statements';
		scope = 'meta.statement.debug';
		settings = {
			fontStyle = 'italic';
			foreground = '#5F5A60';
		};
	},


More information about the textmate mailing list