How to retain Outlining Collapsed when XmlSyntaxLanguage.FormatTextRange

SyntaxEditor Web Languages Add-on for Windows Forms Forum

Posted 6 years ago by NorthGates - NorthGates Systems
Version: 12.1.0311
Avatar

I would like to re-collapse the outline sections that were collapsed before the text range is formatted.

I do capture the IAstNode in a variable prior the format but I can't figure out how to proceed.

Comments (1)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We don't have anything that persists outlining states, but you could recurse down the document.Outlining.RootNode tree through all its child nodes and make a list of any node ranges that are collapsed.  Note that you might want to convert each node's StartOffset and EndOffset to document positions instead (via document.OffsetToPosition) since formatting modifications will likely change offsets but the line/cols will probably stay the same.  Then after formatting, convert your positions back to offsets (document.PositionToOffset), and when you go to restore the outlining state, recurse through the node tree again.  If any node's offsets match the entries in your list then collapse them.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 10 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.