[TxMt] Re: Coloring for a function call

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Dec 29 17:50:16 UTC 2011


On 29 Dec 2011, at 18:18, John Relosa wrote:

> What I was hoping to have is have the arbitrary name of the function "xyz_any_function_name" have a color red when it's defined(after the word "function") or when it's called(after the word "call".
> 

Hi,

maybe try something like (AN EXAMPLE!):

{	name = 'meta.call.your_LG';
	match = '^\s*(call)\s+(\S+)';
	captures = {
		1 = { name = 'keyword.control.your_LG'; };
		2 = { name = 'entity.name.type.call.your_LG'; };
	};
},
{	name = 'meta.function.your_LG';
	match = '^\s*(function)\s+(\S+)';
	captures = {
		1 = { name = 'storage.type.function.your_LG'; };
		2 = { name = 'entity.name.function.your_LG'; };
	};
},


If you assign the same name for the 2. match in 'call' and 'function'  or you write (function|call) the function name will appear in the same colour.

And look in other Language Grammars (C, Ruby, Python, ...) since it's a common task.

Hope it helps a bit.

Best,
--Hans


More information about the textmate mailing list