I'm using IntelliJ's Flex support. In the editor, I start typing an <mx:Script> block. When I type the closing '>', IDEA generates the closing tag for me along with the <![CDATA[]]> section, as I would expect. However, it places the opening of the CDATA block on the same line as the <mx:Script> tag, and it places the closing of the CDATA block in column 1 of the file rather than indenting. I've played around with various XML and other code style settings, but none seem to fix the problem.
I would prefer to have these tags formatted the same way that they are in Adobe's FlexBuilder:
<mx:Script>
<![CDATA[
// My code here
]]>
</mx:Script>
Is there any way to change the default formatting when these script tags are added?
Environment: Mac OS 10.5.5
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <!-- CDATA level matches parent --> <mx:Script> <![CDATA[ private var foo:String; ]]> </mx:Script> <!-- CDATA level in one level from parent parent --> <mx:Script> <![CDATA[ private var foo:String; ]]> </mx:Script> <!-- CDATA level in one level from parent parent, but actual data matches CDATA --> <mx:Script> <![CDATA[ private var foo:String; ]]> </mx:Script> </mx:Application>.. but please for all XML constructs, not just mx
http://youtrack.jetbrains.net/issue/IDEA-24053
Regards,
Peter
- Whitespace around: Preserve (don't change whitespace around "<![CDATA[" and "]]>"), Remove (keep on the same line with tags) and Add new lines. The latter corresponds to the original request.
- Keep whitespace inside (unchecked by default). This option is used only if spaces inside CDATA are essential for some reason. In case of MXML just leave it unchecked to let the formatter insert proper indents.
With "Whitespace around"/"Add new lines" and "Keep whitespace inside" unchecked you will get an MXML file formatted as, for example:<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ // Some code here ]]> </mx:Script> </mx:Application>Please submit separate change requests for other features and/or findings.
What about adding a formatting option for schemaLocation (IDEA-40316)?