Source.UncommentSpan(TextSpan) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Uncomments the given span of text and returns the span of the uncommented block.
public:
virtual Microsoft::VisualStudio::TextManager::Interop::TextSpan UncommentSpan(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
public:
virtual Microsoft::VisualStudio::TextManager::Interop::TextSpan UncommentSpan(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
virtual Microsoft::VisualStudio::TextManager::Interop::TextSpan UncommentSpan(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
public virtual Microsoft.VisualStudio.TextManager.Interop.TextSpan UncommentSpan (Microsoft.VisualStudio.TextManager.Interop.TextSpan span);
abstract member UncommentSpan : Microsoft.VisualStudio.TextManager.Interop.TextSpan -> Microsoft.VisualStudio.TextManager.Interop.TextSpan
override this.UncommentSpan : Microsoft.VisualStudio.TextManager.Interop.TextSpan -> Microsoft.VisualStudio.TextManager.Interop.TextSpan
Public Overridable Function UncommentSpan (span As TextSpan) As TextSpan
Parameters
Returns
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 in a Legacy Language Service for more information about how this method is called.