[TxMt] Re: TM2: strange indenting for C++

Steve King sking at arbor.net
Tue Jan 31 21:38:53 UTC 2012


On 2012-01-25 04:00, Allan Odgaard wrote:
> An example where this makes sense would be:
>
>    if(true)
>      while(false)
>        for(size_t i = 0; i<  10; ++i)
>          continue;
>    return 0;
>
> I don’t think TextMate 1.x is able to properly indent the above, but 2.0 will, even while you type it.
>
> The downside of the line-based rule system is that breaking one statement across multiple lines is effectively unsupported, since each fragment is matched against the patterns and will thus be wrongly classified. I don’t know how this can be improved (other than do binary parsers for each language, but even that is quite a challenge for languages like C++).

If it's a choice between supporting code like your example or supporting 
a single statement split across lines, I say focus on the multi-line 
statement. Anyone who writes deeply nested C (or C-like) code without 
braces needs to be whacked upside the head with a cluestick, not 
encouraged by their editor.

In fact, I'd pay ten times as much if TextMate could be made to deliver 
a high-voltage electric shock to anyone who tried writing such an 
abomination!  Call it something catchy like InvisibleCodeFence and 
you'll sell a million copies.

IMNSHO, of course. :-)

-- 
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>




More information about the textmate mailing list