[TxMt] Re: Dynamic scopes
Christopher Creutzig
christopher at creutzig.de
Mon Feb 20 13:08:26 UTC 2006
Allan Odgaard wrote:
> Is your proposal that TextMate parse your language in the background,
It does that already. At least, I can ask it to, using scopes and
indentation rules. Obviously, I have no idea how the internal
structures of TM work, so my suggestions may be extremely strange, but I
could imagine something like
{
begin = '\bproc\s*\(';
end = 'end_proc';
{
match = '^\s*local\s+(?:(\w+),\s*)*(\w+)\s*;';
captures = {
1 = { name = 'variable.other.foo'; };
2 = { name = 'variable.other.foo'; };
}
}
{
match = '(\b\w+\b)';
captures = {
1 = { inheritName = 'variable.other.foo'; };
}
}
...
}
(A real world pattern would probably look a bit more complicated.)
I'm not sure if the above syntax is all that desirable, but in my
opinion the effect certainly is, namely, to *locally* change the scoping
rules (probably best limited to what scope is actually assigned) based
on the text edited. If a ruby method uses a variable only once and that
variable is not known from an outer block, it would-be-nice[tm] to have
it stick out visually, since it is likely a typo.
> While dynamic scopes could allow for some third party plug-in to
> provide scope names, I am unlikely to venture into the field of
> incremental parsers for the dozen of languages supported by TextMate ;)
I'd certainly cry out loudly if you announced such plans. ;)
Best regards,
Christopher
More information about the textmate
mailing list