Indenting style in snippets (was: [SVN] Bundle commit 576)

Allan Odgaard allan at macromates.com
Sun Apr 10 10:21:10 UTC 2005


On Apr 10, 2005, at 8:27, Chris Thomas wrote:

> BTW, ultimately we need some kind of preferences so that we can 
> support different indentation styles. c.f. 
> <http://www.catb.org/~esr/jargon/html/I/indent-style.html>.

That'd be a nice thing to have, but I'm not sure how to go about the 
execution.

Maybe allow an optional post-processing command/filter per bundle or 
syntax to be used on the snippet, so for the C bundle we'd pipe the 
snippet through 'indent' prior to insertion (each user could then tweak 
the options, or even use another code-formatter)?

I should be able to quickly add this as a hidden option that we can 
experiment with and see if it's worth providing a real interface to 
such a feature, or if it's simply not possible to abstract away coding 
style from the snippets.

Another approach is to introduce placeholders in the snippets, but 
since not only the indenting style differs [1]; giving the user full 
control over reformatting is probably necessary.

Comments?

[1] e.g. space before the terminating ;, if the pointer/reference 
specifier character (*/&) binds to the type or the name etc.




More information about the textmate-dev mailing list