The code outlining feature described in earlier topics supports the collapsing of outlining nodes, where contained text becomes hidden. SyntaxEditor's low-level collapsed region management feature is harnessed to achieve this functionality. This same collapsed regions mechanism can be used independently of code outlining too.
Various text regions can be collapsed (hidden) independent of the outlining features. And in these cases, you can even optionally replace the collapsed region with an adornment.
Collapsed Region Manager
The ICollapsed
When the view's text formatting engine builds up layout data for a view line, it consults the collapsed region manager to see if there are any collapsed regions that it needs to be aware of. When one is found, it ignores the contained text and moves onto the remaining text that should be rendered on the view line.
The ICollapsed
- Raise an event when the collapsed regions change
- Allow consumers to return collapsed regions that contain an offset or intersect a text range
RegionsChanged Event
The manager watches all document text changes and also changes published by ICollapsed
Returning Intersecting Collapsed Regions
The ICollapsed
The Get
Tagging Collapsed Regions
The ICollapsed
Therefore to collapse a region of text without using code outlining, all you need to do is create a tagger for the ICollapsed
At this point if your tagger is in use by your language, you should notice hidden text wherever your tagger designates.
Rendering Intra-Text Adornments in Place of Collapsed Regions
Collapsed regions by default will not render anything in their place. However, there is an option to render an adornment in place of the collapsed region. The code outlining feature uses this option to render the "..."
sort of adornments wherever an outlining node is collapsed.
Since the adornments that are inserted in place of collapsed regions should be inserted in between the surrounding text characters, intra-text adornments are used.
Note
See the Intra-Text Adornments topic for details on how to create intra-text adornments.
What you do is have an IIntra
To sum up, an ICollapsed
Tip
For this mechanism, you can have a single tagger return both the ICollapsed