Share via


How to: Support Outlining

Outlining is used to expand or collapse different regions of text. The way outlining is used can be defined differently by different languages. For more information, see Outlining.

The following demonstrates how to support this command for your language service.

To support outlining

  1. Implement IVsOutliningCapableLanguage on your language service object.

  2. Call AddOutlineRegions on the current outlining session object to add new outline regions.

Robust Programming

When a user selects Collapse To Definitions on the Outlining menu, the IDE calls CollapseToDefinitions on your language service.

When this method is called, the IDE passes in an IVsTextLines pointer (a pointer to a text buffer) and an IVsOutliningSession (a pointer to the current outlining session).

You can call the AddOutlineRegions method for multiple outline regions by specifying these regions in the rgOutlnReg parameter. The rgOutlnReg parameter is a NewOutlineRegion structure. This process lets you to specify different characteristics of the hidden region, such as whether a particular region is expanded or collapsed.

Note

Be careful about hiding new-line characters. Hidden text should extend from the start of the first line to the last character of the last line in a section, leaving the final new-line character visible.

See Also

Tasks

How to: Provide Hidden Text Support

How to: Provide Expanded Outlining Support