Source::ReformatSpan Method (EditArray^, TextSpan)

 

Format the specified span of source.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
virtual void ReformatSpan(
	EditArray^ mgr,
	TextSpan span
)

Parameters

mgr
Type: Microsoft.VisualStudio.Package::EditArray^

An EditArray object that contains the source to be reformatted.

span
Type: Microsoft.VisualStudio.TextManager.Interop::TextSpan

A TextSpan object describing the range of lines to be reformatted.

The EditArray object encapsulates all changes made as a single edit operation for the purposes of undo. So all changes made to the source file have to be given to the EditArray by calling the Add method with each line updated or with a single span encompassing the entire span being formatted.

This method is called when the user selects Format Selection or Format Document. This method is called only if the EnableFormatSelection property is true.

The base method does nothing.

In the default managed package framework implementation of the language service classes, this method is called from the ReformatSelection method and the ReformatDocument method in the ViewFilter class.

See Reformatting Code (Managed Package Framework) for examples of how this method can be implemented and used.

Return to top
Show: