Source.ReformatSpan Method
Format the specified span of source.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Syntax
'宣言
Public Overridable Sub ReformatSpan ( _
mgr As EditArray, _
span As TextSpan _
)
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.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.Package Namespace