Community
Participate
Working Groups
I have set up formatting of a small part of the b3 grammar. When formatting the entire document I get this: function foo ( ) { switch true case "c" : "c" case "a" : "b" default : 11 endswitch; } (woo hoo - nice!) When facing this (faulty) construct: function foo ( ) { switch true default : 11 case "c" : "c" case "a" : "b" endswitch; } A quick fix is offered to move the default last. The quickfix does this with a semantic change by using 'move' on the EList caselist of the switch statement. As the change takes place, the switch statement is automatically reformatted, and the result looks like this: function foo ( ) { switch true case "c" : "c" case "a" : "b" default : 11 endswitch; } Wooops! only one case correctly indented (case "a"), all the other are wrong (off by one indent to the left). Here is the relevant part from the formatter configuration: // SWITCH c.setIndentation( f.getSwitchExpressionAccess().getSwitchKeyword_1(), f.getSwitchExpressionAccess().getEndswitchKeyword_4()); c.setLinewrap().before(f.getCaseAccess().getCaseKeyword_1_0_0()); c.setLinewrap().before(f.getCaseAccess().getDefaultKeyword_1_1()); c.setLinewrap().before(f.getSwitchExpressionAccess().getEndswitchKeyword_4());
hi Hendrik, do you still have the grammar that led to this behavior? cheers, Moritz
This can be reproduced with the Eclipse b3 grammar checked into the Eclipse SVN. (I just tried it, and the problem is still there). I think Sebastian keeps a workspace around with the b3 stuff... - let me know if you need more details where to get b3.
won't fix because it affects the old formatter infrastructure