[txmt-dev] Working with indentation rules

Jacob Carlborg doob at me.com
Tue Sep 17 07:38:16 UTC 2013


I'm working on updating the D bundle with the latest language changes 
and making sure it works properly for TM2.

One thing I noticed is that the indentation rules don't work at all. 
They currently work in TM1 but not in TM2.

This is how they currently look like:

<key>decreaseIndentPattern</key>
<string>^(.*\*/)?\s*\}([^}{"']*\{)?[;\s]*(//.*|/\*.*\*/\s*)?$|^\s*(public|private|protected):\s*$</string>

<key>increaseIndentPattern</key>
<string>^.*\{[^}"']*$|^\s*(public|private|protected):\s*$</string>

<key>indentNextLinePattern</key>
<string>^(?!(.*[};:])?\s*(//|/\*.*\*/\s*$)).*[^\s;:{}]\s*$</string>

If a type a function declaration (same syntax as in C), like this:

void foo ()
     {|}

When I've typed the opening brace it will look like the above (the pipe 
being the position of the cursor). But setting the language to C and 
doing the same will decrease the indentation, as it should. Also, 
pressing enter the indention will increase, if the language is set to C.

All this behave a bit differently compared to how it does in TM1. In TM1 
it will not indent the cursor after pressing enter after the closing 
parenthesis. Also, pressing enter after typing the opening brace will 
correctly increase the indentation with the language set to D in TM1.

Is there anyone that can help me fixing these indention rules to make it 
work properly in TM2?

-- 
/Jacob Carlborg



More information about the textmate-dev mailing list