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.
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.
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.
Please log in to a validated account to post comments.