Udostępnij za pośrednictwem


Source.ReformatSpan Method

Format the specified span of source.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Overridable Sub ReformatSpan ( _
    mgr As EditArray, _
    span As TextSpan _
)
public virtual void ReformatSpan(
    EditArray mgr,
    TextSpan span
)
public:
virtual void ReformatSpan(
    EditArray^ mgr, 
    TextSpan span
)
abstract ReformatSpan : 
        mgr:EditArray * 
        span:TextSpan -> unit 
override ReformatSpan : 
        mgr:EditArray * 
        span:TextSpan -> unit 
public function ReformatSpan(
    mgr : EditArray, 
    span : TextSpan
)

Parameters

Remarks

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.

.NET Framework Security

See Also

Reference

Source Class

Microsoft.VisualStudio.Package Namespace

Other Resources

Reformatting Code (Managed Package Framework)