Hi-
I have some java code that won't indent properly, and I would like to update the syntax so it correctly identifies the end brace.
Simplified code looks like this: package foo;
public class Foo { public static void main(String[] args) { new Transaction() { @Override public void run() throws Rollback { System.out.println("In Main"); } }.execute(); } }
The problem is that the "}.execute();" line should have ended the "new Transaction() {" block- but it doesn't. Whatever is trying to match the end brace doesn't like the .execute() at the end.
Where/how might I be able to fix this?
Thank you,
-jamie
On Aug 9, 2012, at 3:36 PM, jamiesmithnc nabble@jamieandamy.com wrote:
I have some java code that won't indent properly, and I would like to update the syntax so it correctly identifies the end brace.
Simplified code looks like this: […] Where/how might I be able to fix this?
I don’t know if your code made it to this list with messed up indent, if not, I think you are asking for too much, as the indent looked pretty weird ;)
If however you are able to determine line-by-line wether indent should be increase or decrease (or increased only for the following line) then there is hope.
The system is documented here: http://manual.macromates.com/en/appendix#indentation_rules
Allan Odgaard-4 wrote:
On Aug 9, 2012, at 3:36 PM, jamiesmithnc wrote:
I have some java code that won't indent properly, and I would like to update the syntax so it correctly identifies the end brace.
Simplified code looks like this: […] Where/how might I be able to fix this?
I don’t know if your code made it to this list with messed up indent, if not, I think you are asking for too much, as the indent looked pretty weird ;)
If however you are able to determine line-by-line wether indent should be increase or decrease (or increased only for the following line) then there is hope.
The system is documented here: http://manual.macromates.com/en/appendix#indentation_rules
That link is exactly what I needed, thank you. I was looking in the wrong place.
I changed my decreaseIndentPattern to be:
decreaseIndentPattern = '^(.**/)?\s*}([^}{"'']*{)?[;\s]*(//.*|/*.**/\s*)?$|^\s*(public|private|protected):\s*$|}.execute();';
And that did the trick.