File Templates ignoring line returns
I'm trying to modify the "Actionscript Class with Supers" File Template, but Intellij doesn't honor the line returns:
#parse("ActionScript File Header.as") package ${PACKAGE_NAME}#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "") #end { ${Access_modifier} class ${NAME} #if (${Superclass} && ${Superclass} != "")extends ${Superclass}#end #if (${SuperInterfaces} && ${SuperInterfaces} != "")implements #foreach( $i in ${SuperInterfaces} ) #if ($foreach.count > 1),#end $i #end#end { public function ${NAME}() { #if (${Superclass} && ${Superclass} != "")super();#end } } }
Results in:
package events { import flash.events.Event; public class MyEvent extends Event { public MyEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } } }
Why are the braces on the same lines as 'package events' and 'public class ExporterConfigViewPM extends Event'? The "Reformat according to style" checkbox seems to have no effect.
Thanks
Please sign in to leave a comment.
Sorry for delay.
In order to have braces on the next line after package/class/method/etc. declaration you don't need to edit "Actionscript Class with Supers" File Template. It is ok to keep other-style braces in template. Istead you need to edit Settings | Code Style | ActionScript | Wrapping and Braces tab | all subnodes of Braces placement node and set 'Next line' there. After that all newly created classes will be formatted according to your code style. To format already existing code use Code | Reformat Code (Ctrl+Alt+L on Windows).
I've reverted my changes to the templates and ensured I had all the "next line" options set for braces, but the resulting classes are still wonky. Here's one I created today (not a super class):
Problems:
Any ideas? I'm not sure what else could be affecting the behavior of the file templates.
Thanks
What is your IntelliJ IDEA version?
What code style scheme is set at Settings | Code Style?
Please do File | Export Settings, make sure that Code Style and File Templates are included and attach resulting file here.