XML Code folding with self-closing tags not working (fixed)

Syntax highlighting, code folding, brace matching, code indenting, and function list

XML Code folding with self-closing tags not working (fixed)

Postby dsmith » Mon Oct 17, 2011 6:28 pm

An issue I'm having with UE right now is how it handles code folding for XML documents when encountering self-closing tags. It appears to treat the final /> of the self-closing tag as the closing marker for the most recently opened 'standard' tag. Below is an example. Just paste it into a new document and set syntax highlighting to XML:

Code: Select all
<spellcast>
    <rules>
        <xi:include href="Include.xml" xpointer="//include[@name='AutoChangeGear']/*" />
        <xi:include href="Include.xml" xpointer="//include[@name='LevelRequirement']/*" />
        <xi:include href="Include.xml" xpointer="//include[@name='ReturnRules']/*" />
       
        <equip when="precast">
          <head>remove</head>
        </equip>
    </rules>
</spellcast>

Click on the opening 'rules' tag and it shows the closing tag as the /> of the AutoChangeGear line. Click on the 'spellcast' tag and it shows the /> of the LevelRequirement line as being the close. The 'spellcast' to 'LevelRequirement' segment is foldable; the 'rules' to 'AutoChangeGear' is not. The 'equip' tag set below that folds properly.

Given the post about using single quotes in attributes, I tried removing the single quotes from the @name portion, but that didn't have any effect.

Is there a change that could be made in the XML wordfile that would fix this, or is this a genuine bug? Or is there something else I'm missing?

This is a recent problem, but I'm not sure if it first started with the update to 17.30 or not. While I've only rarely used the include tags until recently, I do not recall ever coming across this problem when they were present before. I re-downloaded the xml wordfile from the main site to be sure I had the latest version.


Variant on the code sample:

Code: Select all
<spellcast>
    <rules>
        <xi:include href="Include.xml" xpointer="//include[@name='AutoChangeGear']/*" />
       
        <equip when="precast">
          <head>remove</head>
        </equip>
    </rules>
</spellcast>

Clicking on 'xi:include' shows that it recognizes that entire line as its own tag.
Click on <rules> and it marks it as ending with the /> on the AutoChangeGear line (as in the first example).
Click on <spellcast> open tag and it believes that it is closed with the </rules> tag, and folds accordingly.
dsmith
Newbie
 
Posts: 2
Joined: Mon Sep 13, 2010 2:41 pm

Re: XML Code folding with self-closing tags not working (fixed)

Postby richard.crist » Wed Oct 26, 2011 12:43 pm

I pasted your example XML source into my UEStudio editor and it seems to be working ok for me. The "spellcast", "rules", and "equip" tags all have correct folding and vertical indent line indicators. It could be your XML syntax wordfile needs tweaking.
User avatar
richard.crist
Basic User
Basic User
 
Posts: 11
Joined: Tue Jan 13, 2009 1:33 pm
Location: Nashville, TN, United States

Re: XML Code folding with self-closing tags not working (fixed)

Postby dsmith » Wed Oct 26, 2011 11:08 pm

I checked against my computer at work, which has version 16.30 installed. Folding worked perfectly. Sent a copy of the wordfile home, and it's identical to the wordfile that was originally in my 17.30 install (before downloading the version from the website).

However it's also easy to tell that there's been a change in how UE works with paired elements in XML/HTML files. In v16, UE only highlights pairs of angle brackets, so that you only see slight highlighting at the ends of a single tag. In v17, it highlights the matching half of the full tag (so <equip> matches with </equip>, rather than just the < of <equip> matching the > of <equip>).

I'm not sure what codebase UEStudio is based on, but if it only highlights the angle brackets, that's the old pattern matching system. Folding worked, but it's not as 'nice' about matching tags.
dsmith
Newbie
 
Posts: 2
Joined: Mon Sep 13, 2010 2:41 pm

Re: XML Code folding with self-closing tags not working (fixed)

Postby Mofi » Thu Oct 27, 2011 12:28 am

Highlighting matching XML/HTML/XHTML tags is controlled by configuration setting Display XML/HTML tag highlighting at Advanced - Configuration - Editor Display - Advanced which is a feature introduced with UE v17.00 and UES v11.00.

Highlighting matching > for < is done by the brace matching feature controlled by Enable auto-brace matching at Advanced - Configuration - Editor Display - Brace Matching existing already in first version of UES and in UE since I use UE (v8.00).
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3936
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: XML Code folding with self-closing tags not working (fixed)

Postby richard.crist » Thu Oct 27, 2011 10:42 am

Thank you, Mofi. I need to review all the newer setup options that have come around in the last few versions. :)
User avatar
richard.crist
Basic User
Basic User
 
Posts: 11
Joined: Tue Jan 13, 2009 1:33 pm
Location: Nashville, TN, United States

Re: XML Code folding with self-closing tags not working (fixed)

Postby richard.crist » Tue Nov 01, 2011 4:54 pm

OK...

I just updated from UEStudio 11.10 to 11.20, which effectively picks up the most recent UE changes.

After my update my XML syntax code folding now is broken as described by dsmith in his original post.

If I choose to view my XML as HTML highlighting, then the code folding works ok. Seems as though something is indeed broken in the out-of-the-box version of XML syntax highlighting.

I emailed IDM and attached a PDF document showing screen shots. I also mentioned this forum topic and provided a link to it so they could see that UE and UEStudio are both affected. Thanks for bringing this up dsmith.


IDM has replied to my email:

IDM wrote:Thank you for your message. We are aware of this issue, and this will be addressed in a forthcoming update soon.

Looks like the fix will come soon, possibly in a hotfix. :)
User avatar
richard.crist
Basic User
Basic User
 
Posts: 11
Joined: Tue Jan 13, 2009 1:33 pm
Location: Nashville, TN, United States

Re: XML Code folding with self-closing tags not working (fixed)

Postby JoernH » Tue Dec 13, 2011 3:34 am

Well done Richard and dsmith!

It is fixed in the hotfix build 17.30.0.1012 delivered TODAY :D

JoernH
User avatar
JoernH
Basic User
Basic User
 
Posts: 15
Joined: Tue Mar 10, 2009 10:41 am
Location: Belgium

Re: XML Code folding with self-closing tags not working (fixed)

Postby spitvalve » Tue Jan 10, 2012 10:05 pm

Even after installing the latest version of UE Studio 11.20.0.1006 today, I have the identical symptom as dsmith's original 2011-10-17 post. Was the hotfix 17.30.0.1012 applied only to UE but did not UES?

I also use UE3 16.20.0.1009 on my flash drive, and it highlights and folds XML self-closing tags correctly.

Mark Green
Anchorage, Alaska (USA)
spitvalve
Newbie
 
Posts: 2
Joined: Tue Jan 10, 2012 9:46 pm

Re: XML Code folding with self-closing tags not working (fixed)

Postby richard.crist » Wed Jan 11, 2012 10:07 am

spitvalve,

IDM just sent me a link to a fix (UEStudio version 11.20.0.1009) which fixes the problem. Send an email to idm@idmcomp.com and ask them for that version as a fix for the XML code folding issue. They should reply with a download link for you.
User avatar
richard.crist
Basic User
Basic User
 
Posts: 11
Joined: Tue Jan 13, 2009 1:33 pm
Location: Nashville, TN, United States

Re: XML Code folding with self-closing tags not working (fixed)

Postby spitvalve » Wed Jan 11, 2012 4:05 pm

Richard:

Thank you for the heads-up! I sent an email and within minutes Troy sent me the 11.20.0.1009 update. I installed it and it works great.

-Mark Green dba spitvalve
spitvalve
Newbie
 
Posts: 2
Joined: Tue Jan 10, 2012 9:46 pm


Return to Syntax Highlighting