[TxMt] Indentation of switch/case blocks

Trevor Harmon trevor at vocaro.com
Tue Apr 18 21:13:49 UTC 2006


My switch/case blocks (in Java, for example) normally look something  
like this:

     switch (foo)
     {
         case A:
             bar();
             break;

         default:
             baz();
     }

Note how the lines after "case" and "default" are indented. (They're  
not flush with the line above.) I believe this is a pretty standard  
formatting convention.

However, it seems that TextMate doesn't know about this convention.  
If, for example, you were to type the above snippet, typing "case A:"  
and then hitting Return puts the cursor flush with the line above,  
rather than indented. Likewise, if you were to take the above  
snippet, copy some random text (that has a different indentation),  
then paste it between the "case A" and "bar" lines, TextMate's smart- 
indent feature makes the pasted text flush with "case A", rather than  
indented.

Considering that TextMate is smart about indentation in many other  
ways (such as when you type "{" and then hit Return), I was hoping it  
could be smart about indenting switch/case blocks, too. Is that  
possible? Perhaps there is something I could add to the language  
definition? Thanks,

Trevor

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2363 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20060418/1bc7a2f4/attachment.p7s>


More information about the textmate mailing list