Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
10.0 (99.18)
State
Fixed
Assignee
Rustam Vishnyakov
Subsystem
Flex Support
Affected versions
No Affected versions
Fixed in build
96.907  
  • Created by   Timothy M. Dean
    3 years ago (09 Dec 2008 00:57)
  • Updated by   Taras Tielkes
    18 months ago (10 Aug 2010 14:39)
  • Jira: IDEA-21113
    (history, comments)
 
IDEA-21113 Formatting for auto-generated CDATA section in mx:Script blocks
10
Issue is visible to: All Users
  The issue is visible to the selected user group only
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
Comments (6)
 
History
 
Linked Issues (?)
 
Mark Vedder
  Mark Vedder
20 Oct 2009 23:38
2 years ago
I would like to see auto formatting options for this added to IDEA. Ideally, I would love to see a formatting setting that determines whether the CDATA delimiters appear on the same line or a new line. And in the case of a it being on a new line, having the option of them being at the same indent level as the parent <mx:Script> tags, or indented one more level. And then an option if the data within the CDATA delimiters should be at the same level as the CDATA tags or indented one level. This would allow for some of the following formatting options:

<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>
Marc Mielke
  Marc Mielke
25 Nov 2009 16:55
2 years ago
+1
.. but please for all XML constructs, not just mx
M.Milicevic
  M.Milicevic
25 Nov 2009 17:15
2 years ago
similar issue fro xml comments:

http://youtrack.jetbrains.net/issue/IDEA-24053
Peter Jacobsen
  Peter Jacobsen
30 Apr 2010 22:26
21 months ago
+1

Regards,
Peter
Rustam Vishnyakov
  Rustam Vishnyakov
10 Aug 2010 13:59
18 months ago
Starting from the next Idea X EAP there will be the following two new options in Code Style/XML for CDATA:
  • 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.
Taras Tielkes
  Taras Tielkes
10 Aug 2010 14:39
18 months ago
Rustam, that's a nice feature, thanks!
What about adding a formatting option for schemaLocation (IDEA-40316)?