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@sicher.org http://www.sicher.org
"Strangers have the best candy."
On 22/1/2006, at 21:13, Mikael Säker wrote:
[,,,] 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... :))
While I am unlikely to add this in its raw form, I will keep the suggestion in mind, as coupling scopes with folding patterns, and/or regular expressions (and maybe indent) is something I have a vague idea about could work out really well.