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.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 Function UncommentSpan ( _
span As TextSpan _
) As TextSpan
'Usage
Dim instance As Source
Dim span As TextSpan
Dim returnValue As TextSpan
returnValue = instance.UncommentSpan(span)
public virtual TextSpan UncommentSpan(
TextSpan span
)
public:
virtual TextSpan UncommentSpan(
TextSpan span
)
abstract UncommentSpan :
span:TextSpan -> TextSpan
override UncommentSpan :
span:TextSpan -> TextSpan
public function UncommentSpan(
span : TextSpan
) : TextSpan
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