[TxMt] Request: Matching scopes.

Mikael Säker mikael at sicher.org
Sun Jan 22 20:13:57 UTC 2006


I am doing a bit of Scheme-programming and have spent a few hours  
trying to make TM understand Scheme syntax in a feasible way. Syntax  
coloring is no problem since I can do recursive patterns (via  
includes). However, I cannot find a solution to indentation. What I  
have is a rule that creates a new scope called "expression.scheme"  
for each nested expression, for example:

	(if (= a b)
		(+ c 1)
		(+ d 2))

where 'c' (as well as 'a', 'b' and 'd') has the scope "source.scheme  
expression.scheme expression.scheme".

So, this is my suggestion:

How about making the pattern matching engine scope-aware, so that I  
can match beginning and end of scope? I believe having that would  
make it a breeze to get indentation to work okay with Scheme, just  
make a preference tied to scope "expression.scheme" and tell it to  
increase indentation at the beginning ot the scope and decrease it at  
the end. Each nested scope would then automatically add an  
indentation-level, which is what is needed to indent right. (And  
while I'm at it, to be able to set folding at the beginning and end  
of scopes would also be awesome... :))

I don't think it is possible to do proper indentation for Scheme  
without some new feature, but I could be wrong. Anyone have an  
alternate solution? Please tell me.

Anyway, thanks for an outstanding product!

/M

--
Mikael Säker <mikael at sicher.org>
http://www.sicher.org

"Strangers have the best candy."




More information about the textmate mailing list