User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Syntax highlighting, code folding, brace matching, code indenting, and function list
4 posts Page 1 of 1
Recently, I've started to frequently edit large numbers of XML configuration files.

I'm disappointed with how poorly UltraEdit handles XML code folding. Navigating large XML files in UltraEdit is annoying and I'm not exclusively using Notepad++ which just works.

In Notepad++ I can also select the level I want a document collapsed to. This makes it very easy to navigate XML documents. For example, see the attachment I included showing Notepad++ with an XML file collapsed to level 2. I don't know how to get the same effect with UltraEdit.

In the second attachment I show a view from UE after clicking on collapse all. The folding is not fully collapsed and the folding is inconsistent.

I have a lifetime license for UE and would like to continue to use it, but now that most of my text editing is for XML, I find I rarely use UE other than for large delimited text files where I want to convert delimiters to columns.

I feel like I must be missing something. It seems like a major oversight or weakness for UE to have.

Attachments

I could not reproduce the issue with wrong folding of an XML element containing other elements with CDATA sections in one of my XML files after inserting the line with CDATA section from your screen shot. I think, I would need an example from you to find out why code folding works not expected with the CDATA section.

It could be helpful for you to open Advanced - Settings/Configuration - Editor Display - Syntax Highlighting, select installed wordfile for XML if not already selected, click on button Open, close the configuration with button Cancel, insert left of File Extensions = in first line the string below and save the modified wordfile.

Code: Select all
Block Comment On Alt = <![CDATA[ Block Comment Off Alt = ]]

Now each CDATA section is interpreted as alternate block comment which means a special syntax highlighting can be defined for the entire CDATA section, automatically closing XML tags is disabled on editing data block and code folding ignores everything in the CDATA section while the CDATA section can be itself folded when spanning over multiple lines.

Commands for code folding per level are not available in UltraEdit. But such a feature could be added by yourself by coding an UltraEdit script which asks the user on execution which level to fold, then expands all folds and refolds the tags of specified level.

Do you know the XML Manager?

No! Open the XML Manager view.

  • Click on ribbon tab Coding in group HTML/XML on </> XML symbol and click in popup menu on XML manager on using UE ≥ v23.00 in ribbon mode.
  • Click on Coding - XML - XML manager on using UE for Windows >= v23.00 or UE for Windows ≥ v23.20 in toolbar/menu mode with contemporary menus.
  • Click on View - Views/Lists - XML Manager on using UE for Windows < v23.00 or UE for Windows ≥ v23.20 in toolbar/menu mode with traditional menus.
Several XML editing actions can be done via XML Manager more easily than in document window. Right click on items in XML Manager view, read its help page and see also the power tip XML Manager: In-line editing of XML files.

For enhancement requests regarding XML editing please feel free to send them to IDM support by email. Click on email us directly at top of this page.
Best regards from Austria
Mofi, thank you so much. That did the trick. And, as I hoped, UE is much better than Notepad++.

I still have to read up on the XML manager to make sure I'm not missing features and doing things the hard way. Adding that line of code to the xml.uew was what did the trick.

One follow up question: Is it possible to collapse the text at a certain level?

The XML Manager is really helpful in navigating, but to help me navigate frequently edited configuration files, I'll use comments so that when collapsed I see:

Code: Select all
<Dictionaries>
     <DictionaryInfoDto><!--Mime Type-->
     </DictionaryInfoDto>
     <DictionaryInfoDto><!--Custodian-->
     </DictionaryInfoDto>
<!-- etc. -->

In this example, I can't see the comment in the XML Manager without expanding the DictionaryInfoDto, whereas if the text is collapsed, I can scroll down to find the one I need to edit.

In Notepad++ I can use ALT+1, and SHIFT+ALT+1, where "1" is a number 0-9 representing the collapse level, to collapse/expand the text at the level I want.

In UE, it seems that I have to use the collapse all button (or Ctrl+Add) and then double click on the section (e.g. "dictionaries") I'm interested in in the XML Manager window, which will jump to and expand that section (while keeping the subsection collapsed), that works fine, but it would be nice to have keyboard shortcuts for collapsing/expanding to as specific level.

Thank you again for your help!
I wrote already in my previous answer that a "collapse all of level X" feature is not yet available in UE v23.20.0.43. You need to send an enhancement request for such a feature to IDM support by email. Or as I suggested already you or somebody else code an UltraEdit script for this feature.

By the way: Searching for a string can be done nearly always faster using regular Find or Quick Find than with your eyes on scrolling the file.

There is the setting Automatically unfold hidden areas on Find and Goto at Advanced - Settings/Configuration - Editor Display - Code Folding which should be checked to find a string also in a currently collapsed block and expand the block containing the searched string.
Best regards from Austria
4 posts Page 1 of 1