Source.UncommentSpan Method
Removes any comment characters from the beginning and end of the given span.
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 Function UncommentSpan ( _
span As TextSpan _
) As TextSpan
public virtual TextSpan UncommentSpan(
TextSpan span
)
Parameters
- span
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
A TextSpan object describing the range of lines to examine.
Return Value
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
A new TextSpan object describing the span after the comment characters have been removed.
Remarks
This method determines how best to uncomment the span by deciding between line and block comments, and then calls the UncommentBlock method or the UncommentLines method on the span. Call the GetCommentFormat method to obtain the strings that define a comment.
The base method calls the GetCommentFormat method, and then calls the UncommentLines method if the line comment string is specified; otherwise, this method calls the TrimSpan method to eliminate leading and trailing whitespace and then calls the UncommentBlock method if the block comment strings are specified. Note that this approach always favors removing line comments if both line comment and block comment strings are specified -- even when uncommenting a block of text. Also, the base method cannot handle a mix of block and line comments in the span.
This method is typically called in response to the user selecting the command Uncomment Selection from the Advanced menu on the Edit menu.
Commenting Code (Managed Package Framework) for more information about how this method is called.
.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